Page 1 of 1

PHP in subtitle in 0.8 beta4

Posted: Thu Mar 17, 2005 5:44 am
by lydgate
Okay, I'm not really a PHP pro but I'm trying to get this working . . .

I want rotating quotes instead of a description. This was easy in 0.7. I just put this code into layout.php:

Code: Select all

<?php
$quotes = file("quotes.php");
$quote = rand(0, sizeof($quotes)-1);
echo $quotes[$quote];
?>
Now I understand that I have to put it in config.inc.php and put that file into my style directory. I am trying to use this:

Code: Select all

<?php
$quotes = file("C:\wamp\www\dreams.php");
$quote = rand(0, sizeof($quotes)-1);
$serendipity['head_subtitle'] = $quotes[$quote];
?>
but it doesn't seem to work. I am getting $serendipity['head_subtitle'] because I think that's what it names the description in the smarty? but I don't really understand, obviously. Any help appreciated

Re: PHP in subtitle in 0.8 beta4

Posted: Thu Mar 17, 2005 11:39 am
by garvinhicking
Just try this in config.inc.php:

Code: Select all

$serendipity['smarty']->assign('head_subtitle', $quotes[$quote]);
So you can assign any variables that are used inside the 'index.tpl' Smarty file.

Regard,s
Garvin

Re: PHP in subtitle in 0.8 beta4

Posted: Tue Mar 22, 2005 11:02 pm
by Guest
Thanks, this is exactly what I needed :)