Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.