title: Pulling alias from Joomla content database
body: <p>So I am trying to pull the alias of the current article (the article that the code is placed in) from the database.</p>
  
  <p>I have a PHP snippet to pull the alias of the category of the current article:</p>
  
  <pre><code>&lt;?php // Get category alias
  $db = &amp;JFactory::getDBO();            
  
  $option   = JRequest::getCmd('option');
  $view   = JRequest::getCmd('view');
  
  $temp   = JRequest::getString('id');
  $temp   = explode(':', $temp);
  $id   = $temp[0];
  
  /* Checking if we are making up an article page */
  if ($option == 'com_content' &amp;&amp; $view == 'article' &amp;&amp; $id)
  {            
     /* Trying to get CATEGORY alias from DB */
     $db-&gt;setQuery('SELECT cat.alias FROM #__categories cat RIGHT JOIN #__content cont ON cat.id = cont.catid WHERE cont.id='.$id);   
     $category_alias = $db-&gt;loadResult();           
  }
  ?&gt;
  </code></pre>
  
  <p>I then use the variable <code>$category_alias</code> as a PHP argument for an iframe. All of this is embedded into the article using the plugin DirectPHP.</p>
  
  <p>My problem is to rewrite this code to pull the alias of the current ARTICLE instead of the current CATEGORY.</p>
  
  <p>I have read the Joomla documentation but I am completely stumped on what table/columns I need to use to get the alias of the articles.</p>
  
  <p>Any help is very welcome!</p>