Jump to content

Updating the 'Alias Slug' for Joomla with PHP


alecthorne

Recommended Posts

Hello all.

 

I am trying to change the 'Alias Slug' that a Joomla article uses to make each article unique. This needs to be achieved within a PHP routine, and thus far I have achieved the following:

 

$slugreplace = "12345";

$query = "UPDATE yoo_zoo_item SET alias=$slugreplace WHERE id=$id";

 

This replaces the slug with "12345". However I would like to combine an integer with a string, as below

 

$id = $row['id']; //this is the unique article item number

$name = $row['name'];//this is the article title

$slugreplace = $id.$name;

$query = "UPDATE yoo_zoo_item SET alias=$slugreplace WHERE id=$id";

 

The original slug is not replaced. In fact, only when the variable $slugreplace contains an integer, is the slug replaced. Any value that contains a string is ignored. However I can replace the alias within Joomla itself to be any string/integer combination.

 

What am I missing??

 

I have posted this on the Joomla forum, but no answer as yet. Maybe I am missing something with PHP here ?

 

Thanks, Alec

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.