Hi folks
CREATE a string that can be used as an alias,i.e. in the Articla Alias field.
CODE JFilterOutput::stringURLSafe($string)
EXAMPLE 1 // You might want to make the value of some field become the alias, or use it as part of the path for a category etc... // Below could be used in the Fields Afterstore, Beforestore... $artTitle = $fields['art_title']->value; // value could be 'Hey There' $artTitleAsAlias = JFilterOutput::stringURLSafe($artTitle); // value would become 'hey-there' $config['storages']['#__content']['title'] = $artTitleAsAlias; // value stored in db under title column 'hey-there' // never likely to see this, it is just an example
EXAMPLE 2 // You might want to concat two values $catTitle = $fields['cat_title']->value; // value could be 'Hot Chocolate' $catParentID = $fields['cat_parent_id'] // value could be '7' $catTitleAsAlias = JFilterOutput::stringURLSafe($catTitle); // value would be 'hot-chocolate' $config['storages']['#__category']['alias'] = $catParentID . '-' . $catTitleAsAlias; // value stored in db under alias column '7-hot-chocolate'
Bucklash