<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2729435096253272795</id><updated>2011-10-20T04:21:45.582-07:00</updated><title type='text'>Dinaiz 2.0</title><subtitle type='html'>Development, Web 2.0</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dinaiz-two-dot-zero.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2729435096253272795/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dinaiz-two-dot-zero.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dinaiz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2729435096253272795.post-7287733735286333770</id><published>2008-07-01T22:25:00.000-07:00</published><updated>2008-07-01T22:32:34.118-07:00</updated><title type='text'>Drupal CMS : how to have an image as the block title?</title><content type='html'>In Drupal, you can only have normal text as a block title. What if you hant to have an image ? There are many solutions, unfortunately, as far as I know, all of them involve customizing CSS &lt;span style="font-weight: bold;"&gt;for every block&lt;/span&gt;. Fortunately I'm a lazy guy, so I decided hat was too much (boring) work. Instead I found a solution which allows you to put an image directly changing the title itself, using a kind of markup. Explainations follow.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The idea is to detect if the title is a normal title or an image. If it's an image, then instead of displaying it as normal text, we want Drupal to display...well, obviously, an image! :-)&lt;br /&gt;&lt;br /&gt;As we are limited in the title length I had to put in place a strange syntax ... but it works, at least ! &lt;br /&gt;&lt;br /&gt;Instead of a normal title, my "image" title looks like : &lt;br /&gt;&lt;br /&gt;&lt;code&gt;img=title_contactUsForm.png h=30 w=149 m=switchcalc&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;what does that mean ? &lt;br /&gt;&lt;br /&gt;Well your title HAS to start with img, followed by the image filname.&lt;br /&gt;h is the height &lt;br /&gt;w is the width &lt;br /&gt;then, to specify the path of the image,  you can have either "m", "t" or "e" . They respectively mean "module", "theme" or "theme_engine" , followed by the name of the module, theme or ...theme engine. To understand how it works, please have a look at drupal_get_path function of the drupal api. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Basicaly, what the example above means is that I want to insert an image called "title_contactUsForm.png", located in the directory of the module switchcalc, whose height is 30px and width is 149px. &lt;br /&gt;&lt;br /&gt;Now, to support this syntax, you have to customize the code of your theme's block.tpl.php. &lt;br /&gt;&lt;br /&gt;At the begining you'll find something like : &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;?php if ($block-&amp;gt;subject): ?&amp;gt;&lt;br /&gt;  &amp;lt;h2&amp;gt;&amp;lt;?php print $block-&amp;gt;subject ?&amp;gt;&amp;lt;/h2&amp;gt;&lt;br /&gt;&amp;lt;?php endif;?&amp;gt;&lt;br /&gt; &lt;/code&gt; &lt;br /&gt; &lt;br /&gt;Just replace it by : &lt;br /&gt;&lt;br /&gt;&lt;code&gt; &lt;br /&gt;&amp;lt;?php if ($block-&amp;gt;subject): ?&amp;gt;&lt;br /&gt; &amp;lt;?php if (substr($block-&amp;gt;subject,0,3)=="img") { &lt;br /&gt;  $tok = strtok($block-&amp;gt;subject," ");&lt;br /&gt;  while ($tok !== false) &lt;br /&gt;  {&lt;br /&gt;   switch (substr($tok,0,1))&lt;br /&gt;   {&lt;br /&gt;    case "m":&lt;br /&gt;     $type="module";&lt;br /&gt;     $name=substr($tok,2);&lt;br /&gt;     break;&lt;br /&gt;    case "t":&lt;br /&gt;     $type="theme";&lt;br /&gt;     $name=substr($tok,2);&lt;br /&gt;     break;&lt;br /&gt;    case "e":&lt;br /&gt;     $type="theme_engine";&lt;br /&gt;     $name=substr($tok,2);&lt;br /&gt;     break;&lt;br /&gt;    case "w": &lt;br /&gt;     $imgwidth=substr($tok,2);&lt;br /&gt;     break;&lt;br /&gt;    case "h": &lt;br /&gt;     $imgheight=substr($tok,2); &lt;br /&gt;     break;&lt;br /&gt;    case "i":&lt;br /&gt;     $imgfilename=substr($tok,4);&lt;br /&gt;     break;&lt;br /&gt;   }&lt;br /&gt;   $tok = strtok(" ");&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  echo "&amp;lt;div class='title'&amp;gt;&amp;lt;img src='".drupal_get_path($type,$name).$imgfilename."' height='".$imgheight."' width='".$imgwidth."' /&amp;gt;&amp;lt;/div&amp;gt;"";&lt;br /&gt;  } else { ?&amp;gt; &lt;br /&gt;  &amp;lt;h2 class="title"&amp;gt;&amp;lt;?php print $block-&amp;gt;subject; ?&amp;gt;&amp;lt;/h2&amp;gt;&lt;br /&gt;     &amp;lt;?php } ?&amp;gt;&lt;br /&gt;  &amp;lt;?php endif; ?&amp;gt; &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then this will work for every block whose name starts with "img". &lt;br /&gt;&lt;br /&gt;Please note this code is probably not very robust if you don't enforce the syntax, so feel free to change it and make it better. &lt;br /&gt;&lt;br /&gt;Hope it helps .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2729435096253272795-7287733735286333770?l=dinaiz-two-dot-zero.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dinaiz-two-dot-zero.blogspot.com/feeds/7287733735286333770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2729435096253272795&amp;postID=7287733735286333770' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2729435096253272795/posts/default/7287733735286333770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2729435096253272795/posts/default/7287733735286333770'/><link rel='alternate' type='text/html' href='http://dinaiz-two-dot-zero.blogspot.com/2008/07/drupal-cms-how-to-have-image-as-block.html' title='Drupal CMS : how to have an image as the block title?'/><author><name>Dinaiz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2729435096253272795.post-3044084266404272391</id><published>2008-07-01T22:18:00.000-07:00</published><updated>2008-07-01T22:19:46.172-07:00</updated><title type='text'>Easily add a sitemap to Drupal CMS 6.x !</title><content type='html'>Hi geeks !! &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;So you want to add a sitemap to your drupal based  website ? &lt;/span&gt;&lt;br /&gt;IMHO, Drupal CMS is probably the best CMS available at the moment. It has so many features, and it's so extensible that there's probably nothing you can't do with it. &lt;br /&gt;&lt;br /&gt;That's being said, I had to do a bit of research to find a simple way to have at the same time : &lt;br /&gt;&lt;br /&gt;- search engines- and user- friendly urls (i.e &lt;span style="font-style:italic;"&gt;http://mysite.com/whats-new&lt;/span&gt; instead of &lt;span style="font-style:italic;"&gt;http://mysite.com/node/377&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;- an &lt;a href="http://www.sitemaps.org/"&gt;xml sitemap&lt;/a&gt; that you can use in most search engines&lt;br /&gt;&lt;br /&gt;Drupal CMS has a module called &lt;a href="http://drupal.org/project/xmlsitemap"&gt;xmlsitemap&lt;/a&gt;, but I never managed to make it work properly. Apparently this is due to some bugs in the code, though I'm not sure. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Ok, so what to do ?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Thanks to ramiro at &lt;a href="http://www.seo-expert-blog.com"&gt;SEO expert blog&lt;/a&gt;, we have  a &lt;a href="http://www.seo-expert-blog.com/tutorial/drupal-6-xml-sitemap-for-nodes"&gt;quite simple solution to automatically create a sitemap with nodes and the front page&lt;/a&gt; however, I was surprised that they didn't package the code into a module, so I decided to do it. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.filefactory.com/file/ccaeac/"&gt;You can find the module here&lt;/a&gt;. Please note that I only did really small modification to the code, and all the tricky parts have actually been written by &lt;a href="http://www.seo-expert-blog.com/user/ramiro"&gt;Ramiro&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;How to install ?&lt;/span&gt;&lt;br /&gt;Note that you need Drupal 6.x with &lt;a href="http://drupal.org/project/pathauto"&gt;pathauto module&lt;/a&gt; installed and configured.&lt;br /&gt;&lt;br /&gt;- unzip and copy the sitemap folder into your the 'modules' folder  of your Drupal installation &lt;br /&gt;- go to Administer -&gt; Site building -&gt; Modules &lt;br /&gt;- activate the module by checking the box next to 'sitemap' (in 'other' category) &lt;br /&gt;- Go to http://{your drupal site url}/sitemap.xml &lt;br /&gt;&lt;br /&gt;You should have a nice xml sitemap appearing ! &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.seo-expert-blog.com/tutorial/drupal-6-xml-sitemap-for-nodes"&gt;More information here&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;Hope it works for you,&lt;br /&gt;&lt;br /&gt;cheers&lt;br /&gt;&lt;br /&gt;D.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2729435096253272795-3044084266404272391?l=dinaiz-two-dot-zero.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dinaiz-two-dot-zero.blogspot.com/feeds/3044084266404272391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2729435096253272795&amp;postID=3044084266404272391' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2729435096253272795/posts/default/3044084266404272391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2729435096253272795/posts/default/3044084266404272391'/><link rel='alternate' type='text/html' href='http://dinaiz-two-dot-zero.blogspot.com/2008/07/easily-add-sitemap-to-drupal-cms-6x.html' title='Easily add a sitemap to Drupal CMS 6.x !'/><author><name>Dinaiz</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry></feed>
