Recent Comments
Interesting to find that out, wouldn't have expected it to be a problem. I've had similar...
Creating A Recent Comments Widget With Disqus's API and PHP good code pls try
Glad it helped!
Superb and very informative for me,,,
I am new guy for this PHP. i get it clear idea about your topic.All the points are explained...
If you want to put the number of posts in a different area than the recent comments section...
no, straight php.
It depends, are you using wordpress or joomla? I have a different plugin that checks disqus for...
very cool... it works! Do you know if it is possible to include number of total post likes on...
Hmm...It would probably help if I post a comment on my site so people can actually see my...
| Adding a custom Prefix or Suffix to YOURLS Short URLs |
Posted: November 15th, 2011 - I setup my own url shortener with YOURLS yesterday and everything seems to work perfectly. The only feature I needed that didn't seem to come OOTB is the ability to add a custom prefix or suffix to the url. My short url is http://ajwh.it, and that's good, but in order to put the icing on the cake I wanted to add the letter "e" at the beginning of all of my short urls. It took me a second to figure out the options available to me, but after a bit of digging I came up with the process below: **Note: The instructions below are for YOURLS v1.5 1. Install the Random Keywords plugin and activate it I'm not going to go into the details of how to install the plugin in the post. You can find the directions for installing the plugin here: http://ajwh.it/edf2s 2. Open functions.php and modify the yourls_rnd_string function In the folder where you installed YOURLS open the "function.php" file located in the "includes" folder. Around line 1360 you should see the yourls_rnd_string function. If you want to add a prefix just change the value of $str in the first line of the function. So if you wanted add a prefix of ajw the beginning of your function would look like the example below. // Generate random string of (int)$length length and type $type (see function for details) function yourls_rnd_string ( $length = 5, $type = 0, $charlist = '' ) { $str = 'ajw'; $length = intval( $length ); And that's it! Similarly if you want to add a suffix to all of your newly created short urls then you'll have to modify the $str variable towards the bottom of the function. If anyone knows a better way to do this please let me know. Like I mentioned I have only been using YOURLS for about a day. P.S. If you haven't already check out the YOURLS Shortener plugin for firefox (http://ajwh.it/e3caz). It's pretty cool. |
Latest Posts
- Is Your CFLOOP Hogging Memory or Causing OutOfMemory Errors? - Posted January 13, 2012
- If PHP's file_get_contents Function is Failing With IIS 7 - Posted November 28, 2011
- Using jQuery and Google Finance to Create a Simple Stock Ticker - Posted November 17, 2011
- Adding a custom Prefix or Suffix to YOURLS Short URLs - Posted November 15, 2011
- Creating A Recent Comments Widget With Disqus's API and PHP - Posted November 9, 2011
