How do I (embed my own php code)

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
stephanb
Regular
Posts: 16
Joined: Thu Jul 08, 2004 8:14 pm
Contact:

How do I (embed my own php code)

Post by stephanb »

Code: Select all

<?
$today       = mktime(0, 0, 0, date("m"), date("d"),  date("Y"));
$filingdate  = mktime(0, 0, 0, 6, 15, 2004 );

$start= (int)date("z", $filingdate);
$now  = (int)date("z", $today);
$days = $now - $start;

echo "Day <b>$days</b>";
?>
I want to embed the above php code somewhere on the weblog page, but I cannot seem to find a nice way to accomplish this. It is basically a general question regarding embedded php code.
Any idea ?

/Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: How do I (embed my own php code)

Post by garvinhicking »

Hi Stephan!

A proper place would be your templates/bla/layout.php file. Or depending on your embed method, if you use output-buffer redirection (as described in the docs) inside your $serendipity['indexFile'].

Regards,
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/
robintw
Regular
Posts: 10
Joined: Sat Jul 31, 2004 12:41 am

Post by robintw »

Hi

I have tried to follow these instructions, but cannot find my /templates/bla/layout.php file. The folder bla doesn't seem to exist and I have looked inside my template (blue) folder and layout.php doesn't seem to exist.

I have another bit of php code I would like to insert on the index page (a counter). Is this the right way of doing it??

Robin
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post by tomsommer »

copy layout.php from the "default" folder into your own template folder
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
robintw
Regular
Posts: 10
Joined: Sat Jul 31, 2004 12:41 am

Post by robintw »

Thanks, I've got the layout.php file now...

Where in that file should I put my php bit to set up my counter??

I would like the display for the counter to appear at the bottom if possible or if not then on the left hand side.

Thanks in advance

Robin
Post Reply