Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Updating the 'Alias Slug' for Joomla with PHP

General discussions related to php

Moderators: macek, egami, gesf

Updating the 'Alias Slug' for Joomla with PHP

Postby alecthorne » Sun Feb 03, 2013 1:16 am

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
alecthorne
New php-forum User
New php-forum User
 
Posts: 7
Joined: Wed Dec 26, 2012 4:21 am

Return to PHP General

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron