Help - Search - Members - Calendar
Full Version: Site Integration
Movable Type Community Forum > Additional Resources > Tips and Tricks
Lady Domini
Hi,

I've set up a blog for the news part of my website, but I want to take the format of that and put it on the rest of my website, so everything is uniform. However, just copying the generated code from the blog page doesn't work as it stays static.

How would I add a template for each page so I can put in custom info, but still have journal stuff and links on the left, which will be updated w/ the news page of the site? Do I just have to figure out how to make a template to do this, or do I have to add some sort of hack/add-on or another?

Thanks for any info you can give me.

(if you want to look at it... http://www.oentalox.com/eglantine is the news page, and http://www.oentalox.com/eglantine/links.html is how I want all the pages to be layed out, with the page info on the right...except on that page you can see that the left nav bar didn't update with the "test" post I put on the main blog. Which I understand, the html of the links page doesn't tell anything to update it.)
medic119
From what I gather you have a bunch of more or less static pages that you would like to add a sidebar to. You want the sidebar to update to reflect the current state of the News pages, correct?

The easiest way to do this is through PHP or SSI.

1. Create a new index template within MT. We'll call it sidebar.html. Place just the items you want in your sidebar in it. Format it, lay it out, etc. Make sure the Rebuild Index is checked so it will rebuild as needed when you rebuild your MT Indexes (saving entries, etc). You don't need to add any HEAD, BODY, etc tags as they will be inherited from whichever page its included in. Just put the actual items you wish to display and any formatting tags like DIV, SPAN etc.

2. Open your Static pages inside your favorite editor and locate wherever it is you want your sidebar to show.

3. Add the sidebar through a PHP or SSI include and save.
Ex of a PHP include would be:
<?php include("http://www.oentalox.com/eglantine/sidebar.html"); ?>

4. Now when you rebuild your MT installation by saving an entry etc, the Sidebar will be rebuilt in each of your static pages automatically.

The caveat to this is that all your pages have to be PHP or SSI enabled with the extensions .php or .shtml, otherwise the includes won't work.
nolageek
For my sidebar at reelidentities.org I use a method similar to this, but in the sidebar I have a few if statements that trigger parts on depending on what page it's on. On several of my Index Templates I use something like:

CODE
<php $page = "index"; ?>


or

CODE
<php $page = "schedule"; ?>


or

CODE
<php $page = "planning"; ?>



Then I can have different information in my sidebars by using

CODE
if($index == "index") {
~code~
}


Fell in love with this.

Vincent
Lady Domini
So, basically, I make sidebar.html, and if I want to, I can make if/then statements in it? And it needs to be in php? (or the other one, but I'd be more likely to do php).

Do I have to end sidebar as .html or do I have to end it with .php ?

((Looks like I'll have to learn PHP. So far I've relied on knowing the theory behind things, and knowing what questions to ask and what to look for, but without any knowledge of how to WRITE the code.))

And...do I need to do anything to MT to do these? And were do I put the static pages I've added the sidebar to? Just like normal pages, or can I fiddle with them through MT?

Oh...and where is the 'rebuild' checkbox when making a new MT template? I don't see it. sad.gif It seems standard to be able to rebuild templates in MT, no checkboxes needed.

Heh...sorry for all my questions. smile.gif Thank you two for helping me out! smile.gif
Lady Domini
Hmmm...I tried it, and it seems to include the nav bar all right, but it's not understanding the MT variables.

http://www.oentalox.com/eglantine/links.php

How would I get it to 'understand' them so I don't get what is, to the average user, total gibberish?
medic119
You have to build the sidebar withing MT by creating a new index template. The MT tags are only parsed correctly though MT. So you have to build it in MT then use rebuild to create you page.

As to learning PHP, its good to know, but for what you are wanting its unnecessary unless you want different content like was described.

Otherwise just add the include I gave you into your indexes.

And any page including any PHP needs to end in either .php or .phtml
Lady Domini
QUOTE
You have to build the sidebar withing MT by creating a new index template.


I think that term is tripping me up. What is an 'index template' in particular? I see where I can create new template modules, but is 'index template' something different?
nolageek
QUOTE (Lady Domini @ Jun 9 2003, 09:19 PM)
I think that term is tripping me up.  What is an 'index template' in particular?  I see where I can create new template modules, but is 'index template' something different?

"Index Templates" (I think that name is kind of confusing, since they dont have to be indexes) is the first grouping in your Edit Templates menu. Basically, you can create text files via this. (These can be saved as any file type, .html, .htm, .rdf, .xml, .css, .php, .txt, .inc, etc... as the extention.) The ones that are already in there are Main Index, your rdf/xml feeds, the Style Sheet, Master Archive Index, and maybe a few others.

Any MT tags in these text files will be processed and their output saved as the file name specified. Or, dont use any MT tags and the exact text you put in will be outputted when you "Build Index Templates"

If you are going to be going the php route, I've learned that you can just add .htm and .html to your Apache Handlers definitions (most hosts have an interface to do this) and they will then be processed as php files. That way you wont have to mix .php files with .html!

QUOTE
Add this to your Apache Handlers:

Extention(s): .html, .htm
Type: application/x-httpd-php


Vincent
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.