Page 1 of 1

header and layout.php

Posted: Mon Jul 05, 2004 4:57 pm
by keithstric
I'm trying to insert a custom <head> portion into a Serendipity blog. I tried following the README file using the embed method described there. I'm not having much luck getting this to work as only the left and right sidebars are displayed on only the left side with no content. But, I found this post here in the forum http://php-blog.sourceforge.net/forums/ ... layout+php where garvinhicking says:
Basic idea is: Turn on the embed option in s9y configuration. Then go to one of the template directories and edit layout.php - there you can put in all your header/footer/extra layout information that will wrap the blog. That is the easy way.
I would like to add the header/footer information this way mainly to keep things simple. So, could someone point me to a page somewhere that tells exactly how to do this? Or maybe more information about layout.php? Some examples would be even better :-).

Thanks in advance,

Re: header and layout.php

Posted: Mon Jul 05, 2004 5:26 pm
by garvinhicking
Well, just turn the embed mode on and edit the layout.php of your chosen template.

At the beginning of the file, enter all your html, body, meta, head tags. then let the usual PHP code happen, and at the end of the file, emit your closing html/body tags.

Leave the indexFile set to 'index.php' and then everything will be fine. You don't even have to pay attention to all the wicked PHP stuff inside layout.php, you can wrap your HTML your around those tags.

Good luck! :)

Posted: Mon Jul 05, 2004 6:04 pm
by keithstric
Thanks for the speedy reply :-D. OK, did what you said above and now all I get is the content. The sidebars are no longer there :cry: I've tried putting
serendipity_plugin_api::generate_plugins('left','div');
serendipity_plugin_api::generate_plugins('right','div');
toward the top after and before my html. Then I'm back at getting just the sidebars on the left side of the page. I'm using the default layout.php file in my own theme. Here is what I've modified of the layout.php file:
<?php # $Id: layout.php,v 1.15.4.1 2004/04/07 12:38:20 garvinhicking Exp $

##########################################################################
# serendipity - another blogger... #
##########################################################################
# #
# (c) 2003 Jannis Hermanns <J@hacked.it> #
# http://www.jannis.to/programming/serendipity.html #
# #
##########################################################################
?>
<html>
<head>
<title>keithstric.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Powered-By" content="Serendipity v.0.6-pl2" />
<meta NAME="Author" content="Keith Strickland">
<meta NAME="Copyright" content="Keith Strickland 2003">
<meta NAME="DC.Title" content="keithstric.com Dom Blog">
<meta NAME="description" content="A Domino Based Blog about Lotus Domino, Lotus Notes, Linux, XMail, IMAP and other topics of interest"> <meta NAME="Keywords" content="lotus,domino,blog,template,blogging,blogger,notes,r6,r5,nsf,ntf,Reef,Reefs,Fish Tank,Reef Tank,Aquarium,Strickland,Keith Strickland,Family,William Keith Strickland,Douglasville,Gallery,Photo,Pictures,Reef Pictures,Live Sand,Live Rock,Pets,Coral,Corals,Fish,Saine,Welch,Loudermilk,Red Hat,Linux,Squirrelmail,Lotus Notes,Lotus Domino,AdminP,Registration,Register User,Delete Person,Lotus,Notes,Domino,Administration,Courier IMAP,XMail,XMail Server,IMAP,Coral Identification,Identification,Coral Database,Samba,PDC,Primary Domain Controller,Linux PDC,Samba PDC,befw11s4">
<meta NAME="Revisit-After" content="1 Days">
<link rel="stylesheet" type="text/css" href="/blog/serendipity.css.php" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.keithstric.com/blog/index.ph ... index.rss2" />
<link rel="alternate" type="application/x.atom+xml" title="Atom" href="http://www.keithstric.com/blog/index.ph ... s/atom.xml" />
<style type="text/css">@import "www.keithstric.com/blog/templates/keith ... s";</style>
</head>
<body>

<?php
include_once('serendipity_config.inc.php');
include_once(S9Y_INCLUDE_PATH . 'serendipity_plugin_api.php');
include_once(S9Y_INCLUDE_PATH . 'serendipity_sidebar_items.php');
?>
and then at the end of the file put the </body></html> tags.

Thanks for all your help.

Posted: Mon Jul 05, 2004 6:34 pm
by keithstric
I got it, I turned embedded off :-D

Thanks again for all your help. Don't think I would have figured it out without your help 8)

You can see what I've come up with at http://www.keithstric.com/blog

Posted: Mon Jul 05, 2004 6:58 pm
by keithstric
Well, I may have spoke too soon. Now I have 2 header sections. So, guess I'm back to where I started with only content being displayed and not sidebars :-( Any ideas what I may have done wrong?

Posted: Mon Jul 05, 2004 7:29 pm
by garvinhicking
The code you showed for your layout.php is missing essential parts. All the code with a large if-structure and calls to serendipity_printEntries() are missing, which are inside layout.php. What did you do with them?

You need to have embed turned on in any case if you want to have your own headers.

Please post a link to your complete layout.php (as layout.phps or layout.txt) where you had your layout.php with all the contents it has in previously. There need to be calls to the generate_plugins() functions inside that file already, so you don't need to put them in manually.

Posted: Mon Jul 05, 2004 7:42 pm
by keithstric
I left the default layout.php code alone. I didn't change any of it. I only posted what I changed to keep things simple. Guess it just confused things here. But, I think I may have found it. In the default layout.php there were 2 places that made calls to

serendipity_plugin_api::generate_plugins('left','td');
serendipity_plugin_api::generate_plugins('right','td');

embedded within if statements. I've modified those statements by adding else statements as follows. I know that it isn't ideal, but for right now it works.
if (!$serendipity['embed'] || $serendipity['embed'] === 'false' || $serendipity['embed'] === false) {
serendipity_plugin_api::generate_plugins('left', 'td');
}else{
serendipity_plugin_api::generate_plugins('left','td');
}
and farther toward the end:
if (!$serendipity['embed'] || $serendipity['embed'] === 'false' || $serendipity['embed'] === false) {
serendipity_plugin_api::generate_plugins('right', 'td');
}else{
serendipity_plugin_api::generate_plugins('right', 'td');
}
Not sure if you can get this via the original path but layout.php is located here:
http://www.keithstric.com/blog/template ... layout.php

Editing layout.php

Posted: Sun May 11, 2008 9:10 pm
by RonH.
A n00b question. After turning on the embed mode in the Admin section does one load layout.php into a HTML or TEXT editor to make the changes with to my header and/or footer with while in the embed mode?

Re: Editing layout.php

Posted: Mon May 12, 2008 11:09 am
by garvinhicking
Hi Ron!

This thread is from 2004 -- a lot has changed since then. Have a look at the s9y.org documentation and Expert knowledge database on the page about the Embed mode.

In many cases, because we use Smarty since a few years, you can easily embed footer or other files through the {include_php} statement. Have a loko at the smarty documentation to see how flexible it is.

layout.php has been deprecated since 2005, as well. :)

Regards,
Garvin

Posted: Wed Jun 25, 2008 2:13 am
by salviadepot
thanks garvin, i was about to ask about the same thing and didn't notice the age of the thread.

cheers!