PHOBOSLAB

Blog Home

Asaph 1.0

After two Beta versions of Asaph, here is what I call Asaph 1.0. This is the first proper release, even featuring a readme file and licensing information (GPL v3).

If you’re new to Asaph, watch the screencast on Vimeo.com to see what’s it all about. My own Asaph blog can be found at asaph.phoboslab.org.

Stickney Theme for AsaphMany issues with the RSS-Feed and bugs when editing posts from the admin menu were fixed in this release. I also included another template theme called Stickney which can be activated in the config file.

Download: Asaph version 1.0 – ZIP ~50kb

If you’re updating from a beta version, simply replace all your files (keep the data/ directory!) and edit your settings in lib/asaph_config.class.php. The database layout didn’t change, so there’s no need to invoke the installer.

Read the Asaph project page to learn more.

Sunday, April 6th 2008
— Dominic Szablewski, @phoboslab

139 Comments:

#1matt – Monday, April 7th 2008, 00:18

Great work. I've just installed this on my girlfriend's website and we'll be styling it soon.

#2Isaac Bythewood – Monday, April 7th 2008, 06:13

Amazing. This is nearly a perfect solution for a non-writer like myself who still wants a blogish kind of website hosted by myself and not on tumblr or something.

#3Cawlin – Monday, April 7th 2008, 06:58

Nice!

Everything updated a-ok

#4Lau Ardelean – Monday, April 7th 2008, 16:23

fantastic, super-easy update!!! check out my site at: polyesterair.com

#5Smaran – Tuesday, April 8th 2008, 11:57

Great work! Installed it and it's working well. Thanks.

#6ryp30 – Tuesday, April 8th 2008, 14:15

Made fresh install of v1. Now when I use bookmarklet to post an image I receive "Couldn't load the image!" error.

#7 – ryp30 – Tuesday, April 8th 2008, 14:28

Sorry for last comment, it was permission problem with data directory, although install said that everything is fine.

#8eeallo – Friday, April 11th 2008, 17:49

Great work! Though I'm getting a

Warning: curl_exec() has been disabled for security reasons in /home/hupakko/public_html/log/lib/asaph_post.class.php on line 120
Post Image: Couldn't load the image!

The "allow_url_fopen" is enabled. Any ideas?

#9Dominic – Friday, April 11th 2008, 22:49

Your hoster a weird sense of security. If you change line 112 in the asaph_post.class.php to the following, it should work:

if( is_callable('curl_exec') ) {

#10 – eeallo – Saturday, April 12th 2008, 13:53

Thanks for the tip, but it doesn't help. I reloaded the bookmarklet too and the result is like the error-message above.

Is there anything else to try?

#11Dominic – Saturday, April 12th 2008, 15:29

Apparently is_callable doesn't check if the function is disabled. Stupid PHP bug. Anyway, just change line 112 into the following and it should definitely work for you:

if( false ) {

#12 – eeallo – Saturday, April 12th 2008, 17:10

Yes! Now it seems to be working all right. Thanks for your help.

#13Cawlin – Tuesday, April 15th 2008, 02:00

Just thought I'd drop a line and let you know that NewNewsWire (www.newsgator.com/Individuals/NetNewsWire/Default.aspx) now supports bookmarklets and the asaph bookmarklet works perfectly. Now you can post stuff straight from the RSS reader!

#14Peter – Saturday, April 26th 2008, 12:57

Excellent, really nicely executed, well done!

Do you have any plans to add 'Streams' support - basically tagging, so I can assign clippings to different streams and have them show up on specific pages (and in specific feeds)?

#15jon – Saturday, April 26th 2008, 19:01

i love asaph so much, but my site just randomly stopped working. i get the following error:

Parse error: syntax error, unexpected ')', expecting '(' in /home/myusername/public_html/asaph/index.php on line 11

any idea???

#16Dominic – Sunday, April 27th 2008, 01:01

@Peter: Yeah, maybe in a future version, but don't hold your breath :)

@jon: You need to have PHP5 installed. This error occurs when you're running PHP4.

#17KLS – Monday, April 28th 2008, 21:27

Hi Dominic, firstly, kudos on creating this little gem. I saw it in use by another blogger and love the idea of it. I really want to implement this on my site, however, my host doesn't support php5 yet. By any chance you'll release a backward compatible vers for us on lower versions?

#18Dominic – Monday, April 28th 2008, 22:38

No, I will not release a PHP4 version of Asaph, sorry.

While, arguably, the advantages of PHP5 over PHP4 are slim, PHP5 was released almost 3 years ago. You should kick your host in the butt for not supporting it :)

#19KLS – Tuesday, April 29th 2008, 12:22

That sucks then.

Anyways, I've brought it up with my host, lets see if they'll budge.

#20bopo – Friday, May 2nd 2008, 22:39

Has anyone else been tempted to integrate this into a Wordpress install? In my minds eye I can picture Asaph as a static frontpage (probably the Stickney theme) with a WP sidebar and footer and a link to continue to Wordpress, but for the life of me I don't have any idea how to do it. Just a thought.

Asaph is great by the way. Are there plans for intelligent handling of portrait-oriented pictures? The automatic cropping is a little unfortunate.

#21Herzog – Saturday, May 3rd 2008, 12:31

Hi there,
ASAPH 1.0 - Very nice! I will use that for my website, if it it is ready soon.

greets

#22Sascha – Tuesday, May 6th 2008, 09:27

Hi Dominic,
I really like the tool, its design and simplicity. Cool and very well done. Thanks for that!
greetings
sascha

#23KLS – Tuesday, May 6th 2008, 10:07

Hi mate, my host upgraded my server to PHP5. However, I'm getting a 404 error when installing. What should I use as my prefix in the config file?

#24KLS – Tuesday, May 6th 2008, 12:14

Hi mate, sorry but what does this mean? And how do I rectify it? Thanks.

Correct hostname set: FAILED

Make sure your Asaph_Config::$domain setting is correct. Environment variables indicate a value of "www.khairudinlee.com". If Asaph_Config::$domain is not correctly set, you won't be able to use the bookmarklet.
Correct path set: FAILED

Make sure your Asaph_Config::$absolutePath setting is correct. Environment variables indicate a value of "/inspire/asaph/". If Asaph_Config::$absolutePath is not correctly set, you won't be able to use the bookmarklet.


Magic Quotes deactivated: FAILED

If magic_quotes_gpc is enabled, Asaph will have to do some extra work to revert this stupid behaviour. Turn it off!

#25Dominic – Friday, May 9th 2008, 00:36

Just change your $domain and $absolutePath settings in asaph_config.class.php to the values suggested by the installer.

You can safely ignore the Magic Quotes message.

#26flowh – Friday, May 9th 2008, 08:49

Thanks for this great web app!

#27Peter Clark – Tuesday, May 13th 2008, 00:28

Hi, I get the error:
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/omgponi/public_html/asaph/lib/asaph_post.class.php on line 117

when posting images. any ideas?

#28 – oreneeshy – Thursday, May 15th 2008, 17:19

Ola,
any one up for some support :-)
I installed ASAPH after setting a DB but when checking the install.php it says that the DB doesn't exist although all the other checkups are green... things i didn't change in the $db are 'host' & 'prefix'. what could it be?

#29Dominic – Thursday, May 15th 2008, 19:31

@Peter Clark: You can try to switch to fopen instead of CURL to download files. Change line 112 in the asaph_post.class.php from
if( is_callable('curl_init') ) {
to
if( false ) {

However, if your server has safe_mode enabled there's probably not much you can do, other than complaining to your hoster.


@oreneeshy: Probably a typo. What's the name of your new DB? What did you enter for the $db['database'] setting?

#30 – oreneeshy – Friday, May 16th 2008, 09:50

Hi Dominic tnx for the tip. install.php went green apart from safe mode issues (hoster policy). not all is running though: 1) post are displayed cropped from the top, on both firefox and safari (Mac) - can email a screen shot. 2) Photos are not displayed, is it an issue of safe mode? 3) i have to add index.php to the asaph url other wise i get 'page not found' did i set the wrong absolute path? public static $domain = 'oreneeshy.99k.org';
public static $absolutePath = '/asaph/';

#31Dominic – Friday, May 16th 2008, 15:34

The whiteout theme is intended for very short quotes only. If you need more space, switch to the stickney theme.

If you want to post images, you have to click on them after activating your bookmarklet. Simply putting the image URL in the "Site" field will not do. Still, safe_mode will probably prevent Asaph from downloading images in the first place - if your server is not configured correctly.

And judging from your third problem, your server isn't configured correctly at all. Your Asaph settings are fine, however index.php is not recognized as a directory index. You might be able to fix this, by putting the following into your .htaccess file:
DirectoryIndex index.php

#32 – eeallo – Monday, May 26th 2008, 14:25

Hello again.. :)
For some reason, my Asaph installation stopped working.. I´m getting an "Couldn't load the image!" error every time trying to post a image.

I have the "if( false ) {" -fix in place and It worked fine for a while.

Any ideas on this one?

#33 – xc – Sunday, June 1st 2008, 09:35

you did such a good job on this.

two requests--

1. move the the bookmarklet title into the config file. or atleast name it after the site's title.

2. more verbose error messages. "can't create thumbnail" isn't helpful for diagnosing problems.

thank you!

#34Lowbird – Monday, June 2nd 2008, 01:05

Awesome! I love it. :-)

#35Leandro – Friday, June 6th 2008, 02:33

Awesome..
I'll reform it to batch leech images from a page and put them in "galleries".

Thanks! :)

#36Elmak – Wednesday, June 11th 2008, 16:16

Asaph is wonderful!

Now not to plug, but a couple of you seem to have troubles running Asaph on your host. I'd recommend mine because I've never had a trouble with in the years that I've been hosting with them, and Asaph runs great outta the box. (Plus, if you really wanna go crazy, they let you compile your own version of PHP.)

Dreamhost.com

Use the code ELMAKORG to waive the setup fee!

#37Valentin – Thursday, June 12th 2008, 16:59

Brilliant. Thank you, Dominic.

#38 – Sebastian – Monday, July 7th 2008, 15:29

awesome, just what we needed (running a little magazine) !

hope to see improvements in the near future.

#39 – edouard – Wednesday, July 23rd 2008, 11:39

Some people ask for a comment text associated with picture.
Here is a simple tip to go:
in the templates posts.html.php simply put a php echo nl2br($p['title']) near the img tag.
Nothing to do more stuff, the text is provided by the title.

That's all! Zen

#40roger – Friday, July 25th 2008, 23:14

:( all ok apart from twigged the paths, eventually everything seemed to be working but i click the bookmark and nada ;( what did i screw up? peac.eti.me

#41bNj – Tuesday, August 5th 2008, 11:30

Thank you very much for your ASAPH microbloging ! I've added some features like ajax search, pagination, and video support (youtube, dailymotion), it's fantastic :D

#42Tim Reynolds – Wednesday, August 6th 2008, 00:40

i would really like to see that. Has anyone got the rss to work?? think i am doing something really wrong lol.

#43bNj – Wednesday, August 6th 2008, 12:38

You just have to call this link : yoursiteurl/feed for exemple in my webiste it's : www.bnjlinks.info/v2/feed

#44 – Tim Reynolds – Wednesday, August 6th 2008, 14:12

Thanks
I was very impressed with your modifications. How long did it take you? The blackout background on the js looks gd going to go that one when get 5.

#45bNj – Wednesday, August 6th 2008, 15:02

Thanks, it tooks me two days to do my modifications, i love asaph ;)

#46 – Tim Reynolds – Wednesday, August 6th 2008, 17:01

You and me both then. How did you implement the search? i would love to be able to add search to my page. Was thinkig of adding tags to them and allow searching that way.

#47bNj – Wednesday, August 6th 2008, 17:30

It's hard to explain here how i've wrote the search, it's ajax based, i call a page which call post refering to the keywords while you're typing it. I'm sorry but i can't send you files because i have modified some scripts to work only with my website. But it would be nice if the next Asaph update include this functionnality ;)

#48Tim Reynolds – Wednesday, August 6th 2008, 18:51

Thats fair i know what it is like. good to see the good work. please post any other changes you make i will do once i get round to it. Got to make the rest of my sire first am lacking the motivation to write php right now but it will happen.

#49matt – Tuesday, August 19th 2008, 11:46

Any news on tag or category support?

#50Dominic – Wednesday, August 20th 2008, 07:01

Well, no. I'm currently working on other projects. I will eventually go back to Asaph and add support for YouTube videos and maybe MP3 files, but tags... I don't know, it feels overblown.

Maybe an Asaph Plugin for Wordpress would be another solution.

#51jthomas – Tuesday, September 9th 2008, 20:42

Hi

Excuse me for posting here but I didn't find any other way to contact you. I've been trying to build a site using Asaph. It worked great locally. I managed to install everything and create a new theme. But when I uploaded it, I got a 500 Internal Server Error. It's because of the .htaccess file. I know it is because when I delete it, I don't get the 500 error anymore.

I checked whether I had PHP 5, MySql 5, GD-lib installed and cURL or allow_url_fopen enabled. It's all OK. I don't know how to work with this .htaccess file so I'm asking you, if you know where the problem can be.

Thank you in advance.

#52Dominic – Wednesday, September 10th 2008, 14:31

I guess your hoster forbids the use of .htacces rules in general. There's not much you can do about this other than complaining to your hoster.

However, the .htacces for Asaph is optional - you only need it for clean URLs. Just delete the file and you should be fine.

Btw.: You can find my e-mail address on the imprint page :)

#53bbx – Thursday, September 11th 2008, 14:32

Hi

I didn't see your email, though I had been on that page... Sorry.

I actually figured it out. My hoster doesn't forbid .htaccess rules because I have other .htaccess files actually.
I wanted to redirect "www.mysite.com" to "mysite.com" so I had to add some .htaccess rules. I deleted them first to see if it was the problem but it wasn't.
I then commented your rules and it worked actually! I don't know anything about .htaccess but is seems to work without your rules. I thought you should know it.

Anyway, if you say it's optional, I believe you. It works great now, and I love the bookmarklet tool! So easy.

If you want to check out what I've done, it's right here: wordsondesign.com/

Thanks for sharing Asaph.

Jeremy

#54 – Boboa – Saturday, September 13th 2008, 02:08

Simple tagging for images would be very handy. It would let me replace my entire local photo inspiration file tree.

#55Marie – Tuesday, September 16th 2008, 11:44

Hi, Tim, I'love your micro-blog cms and use it on www.louves.com (nsfw !) with some mod from Nicolas gamovr.mx981.com/ (link to a permanent page, an other cool transition for pictures, an other rss page etc...) - I've also see on alt-tab.org/ that they ad some vidéo...
If you are working on a v2, it could be cool to ad this features and why not music with mp3 ?
With captions, links, pictures, vidéos and MP3 files, Asaph could be the best micro-blog cms on the web !!!

Kiss from France
Marie

#56Marie – Tuesday, September 16th 2008, 16:46

Oups, my message was for Dominic !!

#57 – Michel – Thursday, October 2nd 2008, 17:26

Would someone be so kind and share the coded wisdom of how to add YouTube functionality and else a so far unknown generous intellect feels up to spread? Code snippets, else... Will someone be generous?

#58Salade – Wednesday, October 15th 2008, 20:25

Asaph is an awesome CMS ! thank you very much !
This is a just a little message in order to thank you and to share my website's URL...
I'm using it here:
salade.balboulloude.com

((((:

#59Beth – Saturday, October 25th 2008, 05:58

Any chance of getting some tagging in here and the ability to sort by tag? I love the app!

#60Fab – Monday, October 27th 2008, 10:50

I just love the way to add a website, it just can't be easier...
I installed it and made my own template, you can see it here :
www.onvamangerdeschips.org
but great work, thanks a lot!!!

#61 – dddddddd – Wednesday, November 5th 2008, 00:23

getimagesize() can sometimes fail while the thumbnail creation would not. (returns false inside of createThumb incorrectly). test on this image: www.jamesjean.com/work/pradawallpaper.jpg

#62 – dddddddd – Wednesday, November 5th 2008, 00:23

also, is development dead? i second the tagging request. such a good app started here.

#63echo – Friday, November 14th 2008, 21:19

Hey there, Dominic! I was searching about the Internet for a 'microblogging' script written in PHP and stumbled upon Asaph. Right now I'm just messing around with it to see how a collection of posts look, but I must say I'm digging it so far!
I certainly hope development isn't dead - I just found it! I'm going to comb through the above comments at some point to check out some of the mods mentioned. Hopefully newer versions of Asaph are forthcoming :)
(For the time being, my install is at echoverse.org/asaph/

#64Dominic – Sunday, November 16th 2008, 03:07

Development isn't dead - I'm just working on other projects currently. I hope I'll have some more time in the coming winter months that I can spend on Asaph.

However, I'm sorry to say that tagging is definitely not on the top of my feature list. Maybe I can come up with a plugin system that would other people enable to add tagging support...

#65 – Jay – Saturday, November 29th 2008, 13:01

Hi Dominic, thank you very much for putting such a great little CMS together. Asaph is totally great, and I'm looking forward to using it often.

My question: I'm running Asaph as a news link panel, living in an iframe on a page. What would I need to edit so that the links open in a new tab, rather than in the iframe? I don't want to just meddle away with things, because knowing my luck, I'd break something. Thanks for your help, when you have the time to respond!

#66Dominic – Wednesday, December 3rd 2008, 22:48

You need to add target="_blank" to all links in the template (post.html.php) that you want to open in a new tab. You can also use target="_parent" if you want to open the link in the iframes parent window.

#67Bashenko – Tuesday, December 9th 2008, 19:44

Parse error: syntax error, unexpected ')', expecting '(' in /home/u985/bashenko.ru/www/pic/index.php on line 11

what coud it be?

#68Dominic – Saturday, December 13th 2008, 22:26

@Bashenko: Asaph needs PHP5, you're using PHP4.

#69ZenemiG – Thursday, December 18th 2008, 13:56

I commented this on an older post about Asaph, thought Id bring the comment here so more ppl can see it ;)

First of all, thank you very o so very much for such a wonderfull tool. Me and my best mate had given up on our blog cuz we didnt have as much time as before to post and cuz going through the whole process was sometimes too annoying, this basically saved our blog.

I wanted to post here for two main reasons, one is to, as many have, ask for some features. I really love the simplicity of the app, and I dont mean to change that at all, I just would like if this could integrate to twitter so that you can twit every microblog post, similar to how the twitter plugin for wordpress works. Also, sending a ping back to blog posts would be nice.

After reading all the comments, I have to more things to add:

- I digg the idea of manually cropping the image and making the thumbnail yourself, but when you come to think about it, that is not so easy, since, for example, we at out site dont use any of the given templates, we made out own, and thumnail sizes are different. If you ever think of implementing this, youd have to let people add their thumbnail size on the admin panel. If you could add this, would be nice, although it could make the posting time longer.

- Las point, and this is also from reading the comment, is that someone was asking for templates people have made. Well, we made custome one, feel free to check it out @ sieteblog.com I warn you, its in spanish, but design is universal ;)

Thanks again for this amazing tool.

#70Z. D. Smith – Sunday, December 21st 2008, 06:41

Has anyone been having issues with authentication? As far as I can tell my install is configured correctly (anaphora.apodion.net). But it's the strangest thing: any time I use the bookmarklet in Firefox, it first asks me for my l/p (every time I use it). And then whenever I enter it, I get 'the name or password was not correct!'.

What's strange is that if I run the same bookmarklet, for the same install, in Omniweb (for instance), it works perfectly. Has anybody else experienced some weird bug with Firefox, or do you have a way to debug it?

#71qik – Friday, January 16th 2009, 16:17

I would like to be able to manage the publication of images of time, for example, every hour a new image (from an already added to the database) or once a day.

#72Sentree – Tuesday, January 20th 2009, 12:36

@ #70: Z. D. Smith:
This issue is, because the option in Firefox, to discard third-pary Cookies, is set. Just set an exemption for the site where Asaph is installed and the applet will work for you. :-)

#73qik – Monday, January 26th 2009, 13:16

I would like to be able to manage the publication of images of time, for example, every hour a new image (from an already added to the database) or once a day.
How do I do this?

#74qik – Tuesday, February 3rd 2009, 22:46

After installing the option "ASAPH_LINK_PREFIX" is not "/" and "/?". If you manually remove the "?" get 404 error. Help please.

#75Dominic – Wednesday, February 4th 2009, 02:17

@qik: There's a .htacces file in the ZIP that you need to upload - it's initially hidden on MacOS. Also, your server needs to have mod_rewrite installed and enabled for your site. Ask your hoster if you're unsure.

For you other problem (publish an image once a day) all I can say to you is: learn PHP. There's no magic switch that will enable this functionality in Asaph. It has to be programmed. Unfortunately, I don't have a lot of time at the moment to care about such things, sorry.

#76 – Bob – Thursday, February 26th 2009, 13:14

Hi,

How do I add that there were paged just previous and next but: previous 1 | 2 | 3 | 4 | 5 | ... | next ?

Thanks for help

#77qik – Friday, March 13th 2009, 18:55

Dominic: Thanks for your previous reply. I have a question: how in the file index.php to get the variable with the total number of pages.

Bob: It's simple, use the Paginator — www.smashingmagazine.com/2007/11/16/pagination-gallery-examples-and-good-practices/

#78Kyle – Saturday, March 14th 2009, 09:48

My PHP version was 4.4.7, but the install script did not display the 'die' message. Instead, it just left an entirely blank page. The only way I figured it out was to delete everything but the version check.

#79pm – Saturday, March 14th 2009, 19:39

Hi, thank you for asaph, I love using it. For me, there is not much room for improvement, since it does what I want it to, except for one thing - the english quotation marks seem to be inserted into the title of a post. Since the correct ones in my language are 201C for opening and 201E for closing and I always forget to reset them after an update, they get mixed up in my posts. It would be a handy detail in asaph for me, if the quotation marks were added „on the fly“.
Obviously, no big deal, but it would be a nice option. Thank you,
Petr

#80AsceticMonk – Tuesday, March 17th 2009, 03:43

Hi, just installed Asaph on my site today, and when I try to post a Flickr image using the bookmark, I get the following error:

You don't have permission to access /asaph/admin/post.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

However, if I post text, everything runs fine. Any ideas? Thanks!

#81AsceticMonk – Tuesday, March 17th 2009, 09:46

Actually, looks like it only happens in Flickr.

#82qik – Wednesday, April 8th 2009, 17:08

Dominic: Нow in the file index.php to get the variable with the total number of pages.

#83qik – Saturday, April 11th 2009, 12:56

Are there any plans to further develop the project?

#84Kyle – Tuesday, April 14th 2009, 09:17

I absolutely love this little blog program. I added a few little additions in my asaph ( blog.kyleolsondesign.com ) such as tags and a search feature.

From someone just beginning with php, is was really easy to modify this blog. Thanks!

#85qik – Tuesday, April 14th 2009, 14:02

Kyle: Hi, could you share their developments?
I myself like to make tags, and search, but unfortunately no time to deal with this.

#86Kyle – Tuesday, April 14th 2009, 23:12

Hey, I'll go into how I did tags and my simple search page later, but I have enough time to show people how to do numbered pagination links (ie: << Prev | 1 | 2 | 3 | ... | Next >>)

It's really simple, actually. My example is overly complicated. I can make a simplified example when I have more time.

This adds a class of 'active' to every link that takes you to a new page (so prev won't be active if you're on the first page, next won't be if you're on the last page, and the current page won't be active).
Also, it is in an unordered list, so you'll probably want to use some css to the effect of:
ul.pagination li {float: left; margin: 0 5px} or something like that..
In the template file (e.g. posts.html.php):

        <ul id="pagination">
        	<?php if($pages['total']!=1) {?> <!--check if there exists more than one page -->
            
                <?php if( $pages['prev'] ) { ?> <!--if you can go to a previous page -->
                    <li class="active"><a href="<?php echo ASAPH_LINK_PREFIX.'page/'.$pages['prev']?>" title="Previous page">&lt;&lt;</a></li>
                <?php } else { ?> <!-- no previous page-->
                    <li><a href="#" title="Previous page">&lt;&lt;</a></li>
                <?php } ?>
                
                <?php for ( $i = 1; $i <= $pages['total']; $i++) { //for loop that creates button for each page between 1 and the total number of pages
					if($i==1){ //Make sure the first page is always there
						echo '<li';
						if($i!=$pages['current']){echo ' class="active"';} //if it's not the current page, add class="active"
						echo '><a href="'.ASAPH_LINK_PREFIX.'page/'.$i.'" title="Go to page '.$i.' of '.$pages['total'].'">'.$i.'</a></li>';
					} elseif ($i>=($pages['current']-2)&&$i<=($pages['current']+2)){ // this is to limit the function to only write out pages that are within two pages of the current page (plus or minus)
//this avoids really long pagination areas
						echo '<li';
						if($i!=$pages['current']){echo ' class="active"';}
						echo '><a href="'.ASAPH_LINK_PREFIX.'page/'.$i.'" title="Go to page '.$i.' of '.$pages['total'].'">'.$i.'</a></li>';
					} else if($i==$pages['total']){ // always include last page
						echo '<li';
						if($i!=$pages['current']){echo ' class="active"';}
						echo '><a href="'.ASAPH_LINK_PREFIX.'page/'.$i.'" title="Go to page '.$i.' of '.$pages['total'].'">'.$i.'</a></li>';
					}
				} ?>
                <?php if( $pages['next'] ) { ?> <!--if next page is possible (ie not on last page)
                    <li class="active"><a href="<?php echo ASAPH_LINK_PREFIX.'page/'.$pages['next']?>" title="Next page">&gt;&gt;</a></li>
                <?php } else { ?>
                    <li><a href="#" title="Next page">&gt;&gt;</a></li>
                <?php } ?>
            <?php } else { echo '&nbsp;'; } ?>
      </ul>

Hopefully this comment system lets me post all of that code as is...

#87Kyle – Wednesday, April 15th 2009, 03:48

(is this the right place to post this stuff?)

Feel free to contact me with any questions by the contact page on my site (click 'contact'):
blog.kyleolsondesign.com

Here is the search page code. I'll try to format it better, but keep up; it's a little complicated and definitely a round-about way too do it.
(example page: blog.kyleolsondesign.com/search/fonts%20typography )

Normally for searching a database you'd want to query the database directly and return only results matching the search params.

My search works pretty much the opposite way, making it a lot simpler to get working but theoretically slower (I didn't notice it being particularly slow, but I only have ~70 posts).

This search function returns all posts and creates a new array containing posts that match one or more of the search terms. It sorts the returned results by 1) the number of search term matches (terms can only be separated by spaces. Quotations don't work [yet] and commas will be considered part of the term...), then 2) the date posted (or whatever the default asaph sort is).

The search page uses this url structure:
yourblog.com/search/search terms here

it is also possible (and slightly easier, just not as pretty) to use a new file: yourblog.com/search.php?term=search terms here

1. in the file: index.php (in the root dir)
Before '// blog'
add:

// search
else if( !empty($params[0]) && $params[0] == 'search' ) {
/* $params refers to the url of the page, exploded (divided into an array)
by slashes '/' in the url.

The line above will trigger when you browse the page yourblog.com/search
*/

$term = $params[1];
// This line searches for the second param (e.g.: 'param2' in yourblog.com/param1/param2)
// I defined this as the variable $term to be used in the search page template

$asaph = new Asaph(1000000);
// this call the asaph class
// the number '1000000' MUST be larger than the total posts you have in your database in order to return all possible results.

$posts = $asaph->getPosts( $page );
// gets all posts returned by the calling of the class above

$pages = $asaph->getPages();
// Not entirely necessary unless you set up pagination of the search page later
// If you leave this in, asaph will trigger $pages[total]=1 and the default pagination script will leave the area blank.

include( ASAPH_PATH.Asaph_Config::$templates['search'] );
// Choose which template you want to use (templates are defined in: lib/asaph_config.class.php
}


2. in the file: lib/asaph_config.class.php
after "'posts' => 'templates/YOURTEMPLATES/posts.html.php'," (where 'YOURTEMPLATES' refers to whatever template set you're using)
add:
'search' => 'templates/YOURTEMPLATES/search.html.php',

(where 'YOURTEMPLATES' refers to whatever template set you're using)


3. Create a new file (defined above, for the purposes of this tutorial: templates/YOURTEMPLATES/search.html.php ) to act as the template for the search results page.
It might make sense to start out by making this page a duplicate of 'post.html.php', then making modifications as necessary.
On this new page, add these scripts:

<?php $p_array = array() ?>
<!-- this defines and empty array to push search results into -->

<?php $c = 0 ?>
<!-- this will keep count of how many posts match the search terms -->

<?php foreach( $posts as $p ) {
// For every post in your blog, run this code:

$p['rating'] = 0;
// rating is how many of the search terms are found in the post text

$str = $p['source'] . $p['title'];
// $str is what you are searching through. if the term is the needle, this is the haystack

$termx = explode(' ', $term);
// Get $term from url and separate into array by spaces (can change to commas, etc)

foreach( $termx as $t ){
//for each search term, run this code:

if(strpos(strtolower($str), strtolower($t))!==false){
// NOT CASE SENSITIVE
// if this term is found in the post's text, run this code:

$p['rating']++;
// increase rating for this post by 1

} // end if
} // end $termx loop

if($p['rating']>0){
// If the post contains at least one search term

$c++;
// add to the search results count

$p_array[] = $p;
// include the post in the search results array

} // end if

} // end $posts loop ?>



4. Sort the returned array by relevance
BELOW the code from step 3, add this code:

<?php
// Sort by relevance (based on number of keyword matches)
foreach ($p_array as $key => $row) {
$rating[$key]  = $row['rating'];
}
array_multisort($rating, SORT_DESC, $p_array);
?>



5. (OPTIONAL)
You can add a search results count BELOW the script from step 3 if you want. Use this format:

<p>Your search for &ldquo;<?php echo $term ?>&rdquo; returned <strong><?php echo $c ?></strong> results.<?php if($c==0){?> Please try again with different key words.<?php } ?></p>



6. Loop through $p_array as you would normally use $posts
This is where it could come in handy to copy code from post.html.php

if you do that, replace this line (in search.html.php)
<?php foreach( $posts as $p ) { ?>


with this line:

<?php foreach( $p_array as $p ) {?>

(or really just change $posts to $p_array)

7. Add search box
On any page you wish the search box to appear, add this code:

<div>
<input id="search-field" type="text" name="term" value="" onkeypress="if(event.keyCode == 13){var query = '/search/' + this.value; window.location=query}" />
<input type="button" value="Search" onclick="var query = '/search/' + document.getElementById('search-field').value; window.location=query" />
</div>


7.1 (OPTIONAL for accessibility) This code requires JavaScript to be enabled. If you want a completely accessible search form (with or without javascript enabled), you would need to wrap the input fields in a tag: "<form method="post" action="/search.php">" & "</form>"

Of course then you'd have to make the page 'search.php' exist. To do this, duplicate index.php in the root dir and replace everything in the new file between
// about page

and
include( ASAPH_PATH.Asaph_Config::$templates['posts'] );
}

With the code from step 1.
Then change, in the code from step 1, the line:
$term = $params[1];

to this:
$term = $_GET['term'];


I think everything else should work as normal.


Good luck and feel free to contact me through the form on my site if you need help. I'll do what I can. :)

-Kyle

#88qik – Wednesday, April 15th 2009, 08:31

Thank you very much. Great work.

#89qik – Wednesday, April 15th 2009, 08:36

welovetypography.com/

#90Bertier – Wednesday, April 22nd 2009, 02:41

Hi, just a message to thank you for releasing such a nice piece of code.

I managed to implement that in a few hours : www.musiques-incongrues.net/forum/oeil/

Usage is slightly non standard : images are not posted by human beings but extracted from discussion topics in www.musiques-incongrues.net/forum/

Thanks again.

#91Josh Gunderson – Tuesday, April 28th 2009, 01:40

Holy crap, this is badass! Took me a bit of tweaking to get it to work on my 1&1 hosted site. Very slick. Thanks!


_josh

#92julien – Tuesday, May 5th 2009, 21:56

Hi everybody !

Thanks for all Dominic !

1and1 hosting so i have add "AddType x-mapp-php5 .php" to my .htaccess to enable Php5.
So i think Php5 is ok.

I have a 404 error on my front end, i can access my back end and use the bookmarklet and also thumbnail doesn't appear in back end...

Someone have a tip ?

#93fishyoyo – Monday, May 11th 2009, 17:32

I have installed it, and put my toolbar.when I find a photo in flickr,I click the toobar,the a box show with"Asaph // Post this Site",then i click in the photo,it is show this"Asaph ~ Phoboslab: pre/next" ,i chop i picture here,twitpic.com/4z8oy this is wrong,is is sposed to be show like this"title,image,site "and a post button,i don't know why ,would someone help me ,I get all the DB,PATH,and domain all right, and also the date/ to be 777
"

#94Dominic – Thursday, May 14th 2009, 17:36

@julien, fishyoyo: Seems to be both related to some issue with mod_rewrite. Try disabling mod_rewrite or delete the .htacces file from your Asaph installation.

#95JaeHo Choi – Wednesday, May 27th 2009, 20:30

Thank you very much. Great work!!
I have some questions.
Will there be updates of this project?(sooner or later.)
I hope to see Asaph to have community functions.(like user account)
Hope to see some changes in future!!

#96 – dez – Friday, June 5th 2009, 11:51

Love the application! Will be super cool if we can tag those images with different category... or even rearrange them! :) Thanks for your great work

#97ignaty – Wednesday, July 8th 2009, 12:45

Hi! I love Asaph ;) But it will be better if you make comments, user accounts and tags (no category needed) and maybe video (youtube, vimeo, etc).

Btw, here is mine Asaph gallery - cozacoza.com/

#98Nathan – Tuesday, July 14th 2009, 21:11

look my mine !

If any people like share image , contact me :)

www.rienrienrien.fr

#99Lance – Thursday, July 16th 2009, 19:14

Anyone can explain what's this problem is about?


Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/a4863939/public_html/bookmark/lib/asaph_post.class.php on line 117

Has it something to do with my hosting?

#100Brendan – Tuesday, July 21st 2009, 18:21

Long shot, but does anyone have the template code needed to generate a single post page?

The minimal nature of Asaph is killer, the *only* thing I crave is being able to show individual posts.

#101Sam – Sunday, August 2nd 2009, 07:44

Hey, AstheticMonk posted this a while back - does anyone know how to fix the Forbidden error when trying to use the bookmarklet? I've deleted the .htaccess, as it was causing problems.

Thanks in advance =)

#102Ryan – Monday, August 3rd 2009, 10:59

Hello, ever since Firefox 3.5 I've not been able to use the bookmarklet for Asaph. It works fine in other browsers but not FF3.5 :/

Any ideas?

#103Dominic – Saturday, August 8th 2009, 15:13

It works just fine for me in FF 3.5. What exactly is the problem? Doesn't the bookmarklet appear at all? Can't you login? Can't you post pictures?

You might also want to read this: catb.org/esr/faqs/smart-questions.html :)

#104Ryan – Wednesday, August 12th 2009, 23:48

The bookmarklet pops up for a second then disappears. I'll try it in safe mode.

Thanks for the link :P

#105 – Ryan – Saturday, August 15th 2009, 14:05

It's a conflict with NoScript.

#106Maximiliano Bellucci – Friday, September 4th 2009, 19:14

Hi. I need a little bit of help.
While I'm trying to post an image I get the following error:

"Couldn't load the image!"

I don't get any description. The only thing that comes into my mind is that the php module "magic_quotes_gpc" is ON and in my webhost I can't desable it.

Is that the problem? If not, what other problem could it be and how can I solve it?
I've tried to change the line 112 of the file asaph_post.class.php but it doesn't work.

Looking forward for an answer.

#107 – Chris Foster – Sunday, November 1st 2009, 13:09

Hi,

I wonder what method is used to transfer the images?

I'm using Nginx as the web server and it's fairly well locked down to SFTP-SSH for moving files via Filezilla.

The bookmarklet works and the asaph page renders ok, showing the links, but no images have been uploaded.

Also, I cannot get asaph to display under a subdomain as specified in "public static $domain =" it will only display in the directory path despite registering the subdomain as a CNAME in DNS and creating a link within wordpress to the Subdomain.

Thanks for any suggestions.

#108 – Opher – Monday, November 2nd 2009, 17:39

Hey,

I have been using ASAPH for a few months now and its a great tool for bookmarking inspiration. Everything was working fine and then it just stopped.

When I try to post an image i get the error that it can't load image. Everything works fine if I try to post a site though.

I have gone through to make sure all permissions are correct and everything seems in order. Any help would be greatly appreciated

Thanks

#109Dominic – Friday, November 6th 2009, 12:53

@Chris Foster: If the images get posted (i.e. there's an entry for them) the download worked correctly. If they then don't show up ("broken image") it has probably to do with the read permission for that image. My guess is, that your server return a 403 error instead of the actual image.

The $domain setting is only for telling Asaph where it is – not where it should be. I.e. you will have to set up a subdomain somewhere in you server's admin interface. Asaph will not magically create that subdomain for you.


@Opher: There are two separate problems that would cause this message:

1) The image you're trying to post can somehow not be downloaded, because the server returns a 403 or 404. So check some other images from other sites to make sure that this is not the case.

2.) Your permissions are not correctly set :) Remember that Asaph tries to create a new folder for each year and month in your images/ directory. Also make sure that not only the 'data/images/' directory is writeable, but also the 'data/images/2009' and 'data/images/2009/11' directories are. The same goes for the 'data/thumbs' directory.

#110Todd Peterson – Thursday, November 12th 2009, 23:36

I want to use this script so bad!

I get it installed. I get no errors according to install.php. But when I try to post things from the web with the bookmarklet, my asaph blog page shows up in the post window no matter what. I cannot post.

Can someone help? TIA.

#111Dominic – Friday, November 13th 2009, 17:09

@Todd Peterson: Seems like a really strange problem with your server config. Your /admin/post.php actually returns a "403 forbidden" error, but still loads the main page.

My guess is, that mod_rewrite is somehow involved. You can try and disable mod_rewrite by deleting the .htaccess file that comes with Asaph.

#112Todd Peterson – Friday, November 13th 2009, 22:51

I initially tried deleting .htaccess and no luck. I also tried canceling out a few lines at a time, but still no luck.

I just cannot figure it out.

#113Dominic – Saturday, November 14th 2009, 12:50

Ok, I fiddled around some more with the parameters that get passed to the post.php file. It seems that you only get the 403 error if there is another URL in the parameter string - which Asaph of course needs for the location of the site. The Apache module mod_security seems to filter this for some reason. You can disable it by putting this line at the end of your .htaccess file:

SecFilterEngine Off

#114 – Todd Peterson – Saturday, November 14th 2009, 16:53

Got it working!

I contacted my host about SecFilterEngine Off, and they replied, "we have it enabled by default for all accounts." I wasn't able to do it through .htaccess, but they whitelisted the rule. Whatever.

Thanks for your help and for the great script.

#115cq – Thursday, November 26th 2009, 09:03

hello,I get it installed. I get no errors according to install.php. But when I try to post things from the web with the bookmarklet,only have 3 chooses
"Text/Link Created:
Text:
Site:"
where can i upload my picture?

#116Dominic – Friday, November 27th 2009, 01:06

Just open the Bookmarklet and click on the image you want to post. Watch the Screencast (linked in this article) to see how this works.

#117 – gmkung – Saturday, November 28th 2009, 18:02

You should turn this into a formal service or something. I have been using it for a month and its really easy to use. The functionality is very good and fills up a niche that conventional blogs, Twitter and Facebook are not able to provide. Look for investers!

#118Sheneyan – Sunday, November 29th 2009, 19:26

I have installed asaph in my site,and add some external function like tags and search,I like it very much,thx u a lot.

#119 – Someone – Tuesday, February 2nd 2010, 13:36

Bro Are U not Developing Asaph further? It is a Great app...
Plz Continue :D

#120 – Someone – Tuesday, February 2nd 2010, 23:39

I wish the next version supports tags.
Anyway, I love it!!
Thank you

#121yangpizhi – Sunday, February 28th 2010, 07:47

I love it.
I wish the next version is better.
Now,I have a site powered by Asaph.
digu.us/

#122maxxon – Friday, March 5th 2010, 02:15

thanks) great engine, easy, small and clean)
i hope there will be music and video posting)

#123Paul Hubbard – Sunday, March 7th 2010, 17:04

Looks like php 5.3 broke something. Here's the error:

Fatal error: Call to undefined function imageCreateTrueColor() in /export/website/asaph/lib/asaph_post.class.php on line 186

That's trying to post the image from www.epi.org/economic_snapshots/entry/where_has_all_the_income_gone_look_up/

My site is at asaph.phfactor.net

Any help would be greatly appreciated!

#124Dominic – Sunday, March 7th 2010, 19:34

@Paul Hubbard: Asaph should run fine on PHP 5.3. Seems like you just compiled your new PHP version without the GD-Library. See here: www.php.net/manual/en/image.installation.php

#125Ahtsham – Wednesday, April 21st 2010, 06:55

I am getting 2 errors at the mydomain/admin/install.php page.
1 is that absolute path is not correct, I've tried all but it shows the error everytime.
2 is that magic qoute is not deactiviated, please tell me how to do that?

Thanx

#126Dominic – Wednesday, April 21st 2010, 10:16

@Ahtsham:
1. The warning message tells you what the installer believes to be the correct value. If you installed Asaph in your domain root, it's just /

2. This warning is just a reminder; you can safely ignore it.
(If you want to disable magic quotes, you can do so in you php.ini: www.php.net/manual/en/security.magicquotes.disabling.php
Note that you probably don't have access to your php.ini in a shared hosting environment.)

#127 – dan – Sunday, October 31st 2010, 14:48

Hi. I forgot my admin password. Is there a way to recover (or reset) it?

#128Tobo – Monday, November 1st 2010, 14:58

Add video and music?

Who will produce?

#129 – ivan – Wednesday, February 16th 2011, 19:58

ты пидар!!!

#130Subbu – Monday, May 16th 2011, 23:47

any updates?
how about having an own url for post and a comment system?

#131Art – Friday, May 20th 2011, 16:49

I would pay (as I am sure plenty others would) for added features like separate user accounts (with no access to each others photos), an admin approval system for said images, individual bookmarklets and the chance for others to add addons too? Imagine if everyone who used Asaph 2.0 paid you a $100 or so? I'm sure it would be worth the effort :D If not anyone else here going to take up the challenge?

#132 – The_oNe – Friday, August 5th 2011, 00:22

Awesome work!!

#133Sven – Saturday, December 3rd 2011, 15:50

Superb!
You really done a splendid job!
Thanks Dominic.

#134 – _Nf – Tuesday, December 20th 2011, 15:39

work like a charm on my iPhone !!

<3 asaph =)

#135熠熠 – Tuesday, January 10th 2012, 11:14

i used coolIris made a fash 3D image wall,blog.fengyiyi.com/u/about .
and now problem is feed is not output all item, so this 3D wall is too short.is there anyone can give me a way to make this wall better?

#136hege123 – Friday, June 1st 2012, 05:31

The proposal to increase the tag and search functions, and to do some template.

#137 – Kai – Monday, February 11th 2013, 16:30

Will you ever update Asaph?

#138 – leo – Friday, February 15th 2013, 22:14

I just installed it and I allready love it !
Now I'm gonna try and make videos work. If anyone could give me a hand, it would save me some time :)

#139Naat – Friday, July 25th 2014, 19:29

Having read this I believed it was very enlightening. I appreciate you spending some time and energy to put this information together. I once again find myself personally spending a lot of time both reading and posting comments. But so what, it was still worth it!

Post a Comment:

Comment: (Required)

(use <code> tags for preformatted text; URLs are recognized automatically)

Name: (Required)

Please type phoboslab into the following input field or enable Javascript. This is an anti-spam measure. Sorry for the inconvenience.