Forums

Page title based on contents

Gimbl86 12 Apr, 2010
Hi,
I have created a ChronoConnectivity connection that show some data from a table. The user choose the row to read and I show all field of this row.

I would set the page title to a determinate field value; so the page title changes on row changes.


e.d.:

MYTABLE
#1, House, Car
#2, Castle, Child

the user select #1
--> I load another page that show the #1 row (I can do this)
--> I set the new page title to "House" (I can't do this)
Gimbl86 12 Apr, 2010
OK, I found a solution!

I just put this lines in the body:


<?php
echo '<h1>'.trim($MyRow->Nome).'</h1>';
$document =& JFactory::getDocument();
$document->setTitle($MyRow->Nome);
?>


1) This code doesn't work outside of the body
2) This code work great for me because I show only one record but I think you have problems if you use a cicle to show more records.
This topic is locked and no more replies can be posted.