Actions

Talk

Difference between revisions of "Supporting SEF URLs in your component"

From Joomla! Documentation

(New page: Hi there, for me the following statement does not really makes sense: <source lang="php"> function check() { jimport( 'joomla.filter.output' ); $alias = JFilterOutput::strin...)
 
Line 25: Line 25:
 
$this->alias = JFilterOutput::stringURLSafe($this->alias);
 
$this->alias = JFilterOutput::stringURLSafe($this->alias);
 
</source>
 
</source>
 +
 +
== What is this supposed to mena ==
 +
 +
This sentence is confusing me quite a bit:
 +
 +
"The alias is used in the URL instead of the title (the title is the text you want to have in the url)."
 +
 +
Is this a mistake, or do I just not understand. If so, could anybody explain?

Revision as of 09:04, 21 November 2008

Hi there, for me the following statement does not really makes sense:

function check()
{
       jimport( 'joomla.filter.output' );
       $alias = JFilterOutput::stringURLSafe( $this-­>title );
       if (empty( $this-­>alias ) || $this-­>alias === $alias ) {
               $this->alias = $alias;
       }
       /* All your other checks */
       return true;
}

As I read it, the filtered $alias is only asigned to the table property, if $table->alias is empty OR $table->alias is exactly the same. So in case $this->alias is not empty, the property will not even be checked or reasigned.

What I find more logical is the method used in the Joomla components

if(empty($this->alias)) {
        $this->alias = $this->title;
}
$this->alias = JFilterOutput::stringURLSafe($this->alias);

What is this supposed to mena

This sentence is confusing me quite a bit:

"The alias is used in the URL instead of the title (the title is the text you want to have in the url)."

Is this a mistake, or do I just not understand. If so, could anybody explain?