<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Web Development on Abdullah Diab&#39;s Blog</title>
    <link>https://mpcabd.xyz/tags/web-development/</link>
    <description>Recent content in Web Development on Abdullah Diab&#39;s Blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 30 Mar 2010 22:06:42 +0000</lastBuildDate>
    <atom:link href="https://mpcabd.xyz/tags/web-development/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Display Sub-terms In Drupal Term Page</title>
      <link>https://mpcabd.xyz/display-sub-terms-in-drupal-term-page/</link>
      <pubDate>Tue, 30 Mar 2010 22:06:42 +0000</pubDate>
      <guid>https://mpcabd.xyz/display-sub-terms-in-drupal-term-page/</guid>
      <description>&lt;p&gt;After working with Drupal in the last two months I’ve really got used to searching for modules for every problem I face and installing them.&lt;/p&gt;
&lt;p&gt;While I was working on &lt;a href=&#34;http://www.communityi.net&#34;&gt;iCommunity website&lt;/a&gt;, I was creating taxonomy terms to categorize the files using them. I created terms with sub terms. The problem was that when browsing a specified term the term page doesn’t display the sub terms of that term.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>After working with Drupal in the last two months I’ve really got used to searching for modules for every problem I face and installing them.</p>
<p>While I was working on <a href="http://www.communityi.net">iCommunity website</a>, I was creating taxonomy terms to categorize the files using them. I created terms with sub terms. The problem was that when browsing a specified term the term page doesn’t display the sub terms of that term.</p>
<p>I searched the internet and found <a href="http://www.rbgrn.net/content/194-drupal-taxonomy-how-to-add-list-clickable-sub-categories">a solution</a> that’s working.</p>
<p>After trying it I decided to try developing a module for doing that (just like the author of the solution suggested).</p>
<p>I’m a newbie in developing for Drupal but I knew how to dig my way through it 😀</p>
<p>(You’d be shocked if you knew that I don’t know PHP 😛 I just write code!)</p>
<p>So before I start this post please this is the first time I write modules, and I learned it yesterday 😛 so if you find any error or something wrong tell me 🙂</p>
<p>I named the module Taxonomy subterms. 😀</p>
<p>So the process is just re-implement the function <em>‘theme_taxonomy_term_page’</em> from taxonomy module, but to override it I needed to let Drupal call the function in my module when the user requests <em>‘/taxonomy/term/’</em> so to do that I needed to add the <em>‘hook_menu’</em> function.</p>
<pre class="lang:php decode:1">function taxonomy_subterms_menu() {  
  $items['taxonomy/term/%'] = array(
    'title' =&gt; 'Taxonomy term',
    'page callback' =&gt; 'taxonomy_subterms_term_page',
    'page arguments' =&gt; array(2),
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_CALLBACK,
  );
  
  return $items;
}
</pre>
<p>But by doing this I discovered that the Taxonomy module won’t handle the page, so I couldn’t find a way to tell Taxonomy module to handle the page and my module to complete the handling 🙁 So I copied the ‘taxonomy_term_page’ function and renamed it to ‘taxonomy_subterms_term_page’</p>
<p>Then I re-implemented the ‘theme_taxonomy_term_page’ function so I can add the sub-terms section (just like the solution I mentioned did):</p>
<pre class="lang:php decode:1">function theme_taxonomy_term_page($tids, $result) {
  drupal_add_css(drupal_get_path('module', 'taxonomy') . '/taxonomy.css');
  drupal_add_css(drupal_get_path('module', 'taxonomy_subterms') . '/taxonomy_subterms.css');
  $output = '';

  // Only display the description if we have a single term, to avoid clutter and confusion.
  if (count($tids) == 1) {
    $term = taxonomy_get_term($tids[0]);
    $children = taxonomy_get_children($tids[0]);
    $description = $term-&gt;description;
    if (!empty($description) || sizeof($children) &gt; 0) {
      $output .= '&lt;div class="taxonomy-details-wrapper"&gt;';
      $is_wrapped = true;
    } else {
      $is_wrapped = false;
    }
    // Check that a description is set.
    if (!empty($description)) {
      $output .= '&lt;div class="taxonomy-term-description"&gt;';
      $output .= filter_xss_admin($description);
      $output .= '&lt;/div&gt;';
    }
    if (sizeof($children) &gt; 0) {
      $output .= '&lt;div class="sub-terms-list"&gt;&lt;h3&gt;' . t('Sub-Terms:') . '&lt;/h3&gt; &lt;ul class="sub-terms inline"&gt;';
      foreach($children as $child) {
        $output .= '&lt;li&gt;' . l($child-&gt;name, taxonomy_term_path($child)) . '&lt;/li&gt;';
      }
      $output .= '&lt;/ul&gt;&lt;/div&gt;';
    }
    if ($is_wrapped) {
      $output .= '&lt;/div&gt;';
    }
  }

  $output .= taxonomy_render_nodes($result);

  return $output;
}
</pre>
<p>Then I had my module working and installed it in the website (you can check it out <a href="http://www.communityi.net/taxonomy/term/3">here</a>. The page is in Arabic but you can easily find the sub terms).</p>
<h2 id="download">Download</h2>
<p>You can download the module <a href="http://www.box.net/shared/hzahnghh6x">here</a> (I didn’t maintain a project @ Drupal because I’m not yet ready to do that, this is just a small experiment).</p>]]></content:encoded>
    </item>
    <item>
      <title>Bring Down IE6</title>
      <link>https://mpcabd.xyz/bring-down-ie6/</link>
      <pubDate>Sat, 28 Mar 2009 14:00:17 +0000</pubDate>
      <guid>https://mpcabd.xyz/bring-down-ie6/</guid>
      <description>&lt;div class=&#34;column&#34;&gt;
  &lt;h2&gt;
  &lt;/h2&gt;
  &lt;p&gt;
    I have copied the following post from &lt;a href=&#34;http://www.bringdownie6.com/&#34;&gt;this site&lt;/a&gt;.
  &lt;/p&gt;
  &lt;p&gt;
    &lt;img class=&#34;aligncenter&#34; title=&#34;Bring IE6 Down&#34; src=&#34;http://www.netmag.co.uk/files/bd.png&#34; alt=&#34;&#34; width=&#34;117&#34; height=&#34;120&#34; /&gt;
  &lt;/p&gt;
  &lt;h2&gt;
    Discover the mission
  &lt;/h2&gt;
  &lt;p&gt;
    The premise is simple: Internet Explorer 6 is antiquated, doesn’t support key web standards, and should be phased out. This isn’t about being anti-Microsoft, it’s about Microsoft’s lack of development in the browser market. With IE7/8 not available for Windows 2000, IE6 accounts for up to 20% of web usage, primarily via business users. Clients pressure designers to ‘force’ sites to work in IE6, and designers, not wanting to lose business, comply, using hacks and workarounds. This wastes time and money. Microsoft needs to fix this, designers need to unite, and we all need to move on.
  &lt;/p&gt;
  &lt;div class=&#34;column&#34;&gt;
    &lt;h2&gt;
      Read the article
    &lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;
  In our article, ‘&amp;lt;a href=&amp;quot;http://www.bringdownie6.com/bring-down-ie-6.html&amp;quot;&amp;gt;Calling time on IE6&amp;lt;/a&amp;gt;’, we ask designers and developers if it’s finally time to take IE6 behind the shed and shoot it. Major names in the web industry debate our mission, talking about the pros and cons behind dumping IE6. How feasible is it to shun the browser entirely? What can you do to minimise the impact IE6 has on you and your clients (and increasingly tight budgets)? And what can and should Microsoft do to help us all move the web and web standards on? &amp;lt;a href=&amp;quot;http://www.bringdownie6.com/bring-down-ie-6.html&amp;quot;&amp;gt;Find out by reading the article&amp;lt;/a&amp;gt;, or just ‘skip to the end’ by looking to the right and getting involved.&amp;lt;br /&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;</description>
      <content:encoded><![CDATA[<div class="column">
  <h2>
  </h2>
  <p>
    I have copied the following post from <a href="http://www.bringdownie6.com/">this site</a>.
  </p>
  <p>
    <img class="aligncenter" title="Bring IE6 Down" src="http://www.netmag.co.uk/files/bd.png" alt="" width="117" height="120" />
  </p>
  <h2>
    Discover the mission
  </h2>
  <p>
    The premise is simple: Internet Explorer 6 is antiquated, doesn’t support key web standards, and should be phased out. This isn’t about being anti-Microsoft, it’s about Microsoft’s lack of development in the browser market. With IE7/8 not available for Windows 2000, IE6 accounts for up to 20% of web usage, primarily via business users. Clients pressure designers to ‘force’ sites to work in IE6, and designers, not wanting to lose business, comply, using hacks and workarounds. This wastes time and money. Microsoft needs to fix this, designers need to unite, and we all need to move on.
  </p>
  <div class="column">
    <h2>
      Read the article
    </h2>
<pre><code>&lt;p&gt;
  In our article, ‘&lt;a href=&quot;http://www.bringdownie6.com/bring-down-ie-6.html&quot;&gt;Calling time on IE6&lt;/a&gt;’, we ask designers and developers if it’s finally time to take IE6 behind the shed and shoot it. Major names in the web industry debate our mission, talking about the pros and cons behind dumping IE6. How feasible is it to shun the browser entirely? What can you do to minimise the impact IE6 has on you and your clients (and increasingly tight budgets)? And what can and should Microsoft do to help us all move the web and web standards on? &lt;a href=&quot;http://www.bringdownie6.com/bring-down-ie-6.html&quot;&gt;Find out by reading the article&lt;/a&gt;, or just ‘skip to the end’ by looking to the right and getting involved.&lt;br /&gt; 
</code></pre>
</p>
<pre><code>&lt;div class=&quot;column&quot;&gt;
  &lt;h2&gt;
    Get involved
  &lt;/h2&gt;
  
  &lt;ul&gt;
    &lt;li&gt;
      &lt;a href=&quot;http://www.netmag.co.uk/files/bd.png&quot;&gt;Put our logo on your site&lt;/a&gt; and then &lt;a href=&quot;http://www.bringdownie6.com/&quot;&gt;link to this site&lt;/a&gt;. &lt;a href=&quot;http://www.twitter.com/netmag&quot;&gt;Follow us on Twitter&lt;/a&gt;.
    &lt;/li&gt;
    &lt;li&gt;
      Educate your colleagues, users and clients regarding calling time on IE6.
    &lt;/li&gt;
    &lt;li&gt;
      Ensure sites work in IE6, but don&amp;#8217;t waste a lot of time fixing non-critical issues.
    &lt;/li&gt;
    &lt;li&gt;
      Provide an upgrade notice for IE6 users by adding this code to your page: &lt;pre class=&quot;lang:html decode:true&quot;&gt;
</code></pre>
<p>&lt;style type=&ldquo;text/css&rdquo;&gt;
#ie6Warning {
background:#E3E3E3 none repeat scroll 0 0;
border:1px solid #BBBBBB;
margin-bottom:10px;
padding:10px 10px 1px;
}
#ie6Warning h2 {
background:transparent url(<a href="http://www.bringdownie6.com/assets/ie6-warning.gif">http://www.bringdownie6.com/assets/ie6-warning.gif</a>) no-repeat scroll 0 50%;
padding-left:40px;
}
&lt;/style&gt;
&lt;!–[if lt IE 7]&gt;
&lt;div id=&ldquo;ie6Warning&rdquo;&gt;
&lt;h2&gt;Time to upgrade your browser&lt;/h2&gt;
&lt;p&gt;If you&rsquo;re reading this, you&rsquo;re surfing using Internet Explorer 6, an eight-year-old browser that cannot cope with the demands of the modern internet. For the best web experience, we strongly recommend upgrading to &lt;a xhref=&ldquo;<a href="http://www.getfirefox.com/%22&amp;gt;Firefox&amp;lt;/a&amp;gt;">http://www.getfirefox.com/&quot;&amp;gt;Firefox&amp;lt;/a&amp;gt;</a>, &lt;a xhref=&ldquo;<a href="http://www.opera.com/%22&amp;gt;Opera&amp;lt;/a&amp;gt;">http://www.opera.com/&quot;&amp;gt;Opera&amp;lt;/a&amp;gt;</a>, &lt;a xhref=&ldquo;<a href="http://www.apple.com/safari/%22&amp;gt;Safari&amp;lt;/a&amp;gt;">http://www.apple.com/safari/&quot;&amp;gt;Safari&amp;lt;/a&amp;gt;</a>, &lt;a xhref=&ldquo;<a href="http://www.google.com/chrome%22&amp;gt;Google">http://www.google.com/chrome&quot;&amp;gt;Google</a> Chrome&lt;/a&gt;, or a more recent version of &lt;a xhref=&ldquo;<a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx%22&amp;gt;Internet">http://www.microsoft.com/windows/downloads/ie/getitnow.mspx&quot;&amp;gt;Internet</a> Explorer&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;![endif]–&gt;
</pre>
</li></p>
<pre><code>    &lt;li&gt;
      Spread the word
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
</code></pre>
  </div>
</div>]]></content:encoded>
    </item>
  </channel>
</rss>
