PHP in subtitle in 0.8 beta4

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
lydgate
Posts: 3
Joined: Thu Mar 17, 2005 5:38 am

PHP in subtitle in 0.8 beta4

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PHP in subtitle in 0.8 beta4

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Re: PHP in subtitle in 0.8 beta4

Post by Guest »

Thanks, this is exactly what I needed :)
Post Reply