Displaying meta keywords in articles E-mail
Saturday, 16 May 2009 23:12

It took a while but I found what I was looking for: an extension that allowed me to display meta keywords within articles.  The bonus is it turns each one into a link with which you can browse other articles sharing that keyword.

I made one small and easy tweak.  By default the plugin only displays the tags in individual article view.  I modified the SearchTag.php file from:

if ((JRequest :: getVar('view')) == 'article'){


if (((JRequest :: getVar('view')) == 'article') || ((JRequest :: getVar('view')) == 'frontpage')) {

Now the tags appear on the frontpage as well.

Tags: keywords  meta  extension  plugin  Joomla!  tweak  SearchTag  code  
sh404SEF and RSS E-mail
Sunday, 03 May 2009 00:12

Like many Joomla! users out there I use the sh404SEF component for SEO-friendly URLs.  When I decided today to activate the RSS feed for this site, I ran into a certain problem.

The sh404SEF component was renaming the RSS URL:


to index.php/feed/rss.html, which just wasn't working.

I wanted to use FeedBurner to syndicate the feed, and I was able to find an easy solution to the sh404SEF problem in this forum post.  The solution, shown below, involves creating a custom redirect in sh404SEF for the proper feed URL, and supplying that to FeedBurner.  From there the FeedBurner URL takes over and you can syndicate your RSS feed to the world.

(image below is from the forum post linked to above)

sh404SEF custom redirect

Tags: RSS  sh404SEF  Joomla!  FeedBurner  forum  
On logo design E-mail
Saturday, 02 May 2009 22:16

On this site I came across this site of 45 rules for creating a great logo.  I decided to evaluate the p()thesis logo using the criteria given.


Tags: list  design  logo  pthesis  analysis  
Joomla! Code display - harder than I thought E-mail
Thursday, 23 April 2009 15:43


Finally, got one working!  It took a while but I got Highlight Code with Jumi working after modifying the helper file.  Specifically, I had to remove references to:


And replace them with the relative path of the files in question.  I also didn't like how the plugin hid the code by default and gave the user a JavaScript function to expand/collapse the codebox.  I got rid of that by disabling the JavaScript file and modifying the helper file as follows (note the commented lines near the bottom):
class highlightHelper {
 function add_tags() {
  global $mainframe;
  $document = &JFactory::getDocument();
  $plugin = &JPluginHelper::getPlugin('content', 'cdchilicode');
  $pluginParams = new JParameter($plugin->params);
  $document->addStyleSheet('plugins/content/highlight/highlight.css', 'text/css');
//  $document->addScript('plugins/content/highlight/highlight.js');
  $style = 'display: block;max-height:'.$pluginParams->get('height', "350px").
    ';width:'.$pluginParams->get('width', "650px");
  $mainframe->addCustomHeadTag('<style type="text/css">div.highlight { '.$style.' } </style>');
function highlight_replacer(&$match) {
  global $mainframe, $loaded_script, $highlight_id;
  $db = &JFactory::getDBO();
  $plugin = &JPluginHelper::getPlugin('content', 'cdchilicode');
  $pluginParams = new JParameter($plugin->params);

if ($match[2] && !file_exists("components/com_jumi/jumi.php")) {
   return '<p class="highlight_error">'.JText::_('ERROR_JUMI_COMP').'</p>';
  }($match[1] == "html") {
   $lang = "html4strict";
  else {
   $lang = $match[1];
  if ($match[1] == "html4strict") { $match[1] = "html"; }
  if (!file_exists("libraries/geshi/geshi/".$lang.".php")) {
   return '<p class="highlight_error">'.str_replace("%s", $lang,
  if (!$match[2]) {
   $code = $match[3];
   $code = str_replace("</p>", "<br />", $code);
   $code = str_replace("</div>", "<br />", $code);
   $code = str_replace("<br />", "\r\n", $code);
   $code = preg_replace("#<(.*?)>#is", "", $code);
   $code = html_entity_decode($code, ENT_QUOTES, "UTF-8");

elseif ($match[2] > 0) {
   $db->setQuery("Select custom_script from #__jumi where id='$match[2]'");
   $code = $db->loadResult();
else {
   $db->setQuery("Select custom_script from #__jumi where alias='$match[2]' limit 1");
   $code = $db->loadResult();

$geshi = new GeSHi($code, $lang);

  $out = '<div id="highlight-'.$highlight_id.'" class="highlight">'.
//  if ($pluginParams->get('hidde', 1)) {
//   $out = '<a class="highlight_mostrar" id="highlight-mostrar-'.
    $highlight_id.'" href="javascript:mostrar_ocultar('.$highlight_id.')">'.
    str_replace("%s", $match[2], JText::_('MOSTRAR_OCULTAR')).'</a>'.$out;
//  }
  return $out;

I have spent the better part of two hours trying to implement a simple code display into my Joomla! installation, with still no success.  There are 12 plugins listed here in the Extensions directory, 7 of which are v1.5 native.

I have gone through all of them.  I have read their documentation, peeked into and tweaked the PHP files, but still no go.  Either some error shows up or nothing happens at all.  I didn't realize something so simple would end up being so hard!

Dynamic portfolio E-mail
Saturday, 18 April 2009 22:38

I wanted to give visitors a third "plain-clothes" option for viewing my portfolio - plain-clothes being without JavaScript or Flash.  But at the same time I wanted the data to be dynamically populated, the way it is in the jQuery and Flash versions.

The task was pretty easy using PHP 5's built-in XML DOMDocument class.  I used the same XML files that carry the data for the other sites, and rendered it with the following PHP code:

$xmlDoc = new DOMDocument();
$xmlDoc->load("name of XML file");
    $sites = $xmlDoc->getElementsByTagName("site");
    foreach ($sites as $site){
     echo "<p 'style=color:#CD6620;'><strong>" . 
    $site->getElementsByTagName('site_title')->item(0)->nodeValue . "</strong></p>";
     if ($site->getElementsByTagName('imageURL2')->item(0)->nodeValue == ""){
        echo "<p><a target='_blank' title='Visit site' href='" . 
    $site->getElementsByTagName('siteURL')->item(0)->nodeValue . 
    "'><img title='" . $site->getElementsByTagName('site_title')->
    item(0)->nodeValue . "' alt='" . $site->getElementsByTagName('site_title')->
    item(0)->nodeValue . "' src='" . $site->getElementsByTagName('imageURL')->item(0)->
    nodeValue . "' /></a></p>";

        echo "<p><a target='_blank' title='Visit site' href='" . 
    $site->getElementsByTagName('siteURL')->item(0)->nodeValue . 
    "'><img title='" . $site->getElementsByTagName('site_title')->
    item(0)->nodeValue . "' alt='" . $site->getElementsByTagName('site_title')->
    item(0)->nodeValue . "' src='" . $site->getElementsByTagName('imageURL')->item(0)->
    nodeValue . "' /></a>" . 
        "   <a target='_blank' title='Visit site' href='" . 
    $site->getElementsByTagName('siteURL2')->item(0)->nodeValue . 
    "'><img title='" . $site->getElementsByTagName('site_title')->
    item(0)->nodeValue . "' alt='" . $site->getElementsByTagName('site_title')->
    item(0)->nodeValue . "' src='" . $site->getElementsByTagName('imageURL2')->item(0)->
    nodeValue . "' /></a></p>";

echo "<p>" . $site->getElementsByTagName('description')->item(0)->nodeValue . "</p>";
     if ($site->getElementsByTagName('site_details')->item(0)->nodeValue != ""){
      echo "<p>" . $site->getElementsByTagName('site_details')->item(0)->nodeValue . "</p>";
     echo "<p><strong>Skills used</strong>" . $site->getElementsByTagName('skills_used')->
    item(0)->nodeValue . "</p><hr />";

echo "<p>" . $site->getElementsByTagName('description')->item(0)->nodeValue . "</p>";
     if ($site->getElementsByTagName('site_details')->item(0)->nodeValue != ""){
      echo "<p>" . $site->getElementsByTagName('site_details')->item(0)->nodeValue . "</p>";
     echo "<p><strong>Skills used</strong>" . $site->getElementsByTagName('skills_used')->
    item(0)->nodeValue . "</p><hr />";

I used the DirectPHP plugin available for Joomla, and placed the code above inside PHP tags within the article content.

The result can be viewed here

Tags: XML  PHP  portfolio  DirectPHP  code  
Pthesis on Browsershots.org E-mail
Thursday, 16 April 2009 12:38

My site Pthesis.com has been approved to be added to Browsershots.org.

Book review | CodeIgniter E-mail
Sunday, 12 April 2009 10:27

I've read two books on CodeIgniter lately, and just wanted a write a few words about each one.


Professional CodeIgniterThis is the first book I read.  I found it informative, and I really appreciated its example-based approach.  It was a bonus that it used Agile methodology, although that wasn't its main focus.

The book, like any other technical book, is rife with errors and small oversights, but overall the book is a great way to get started with CodeIgniter.  This book is more about using CodeIgniter than about how it works, which is great, because it's complemented very well by the next book I read.










CodeIgniter for Rapid PHP Application DevelopmentThis book talks more about how CodeIgniter does its thing: how controllers work, how controllers interact with models and views, and what the limitations of each facet of the system are.  For example, users can't interact directly with models, libraries, helpers, or plug-ins.

It also talks about good practices.  Models, for example, can call views, but shouldn't, because that's the controller's job.

It explains the Active Record class, and gives a glimpse of what goes on behind the scenes in CodeIgniter that's conveniently hidden from the developer.

Overall it's a good book for not only learning about CodeIgniter but also the programming principles it is based on, like MVC and Active Record.  If I'm unclear on something I read or did from the previous book, this is the first place I would check for an explanation.


Page 12 of 18