4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Term on October 17, 2002, 06:09:35 PM

Title: Creating Templates
Post by: Term on October 17, 2002, 06:09:35 PM
How could I create my own templates? So I could call
Code: [Select]
{Menu} or somthin like that in a template such as home.html....

Anyone?
Title: Creating Templates
Post by: Term on October 17, 2002, 06:24:38 PM
I think its somthing like...
Code: [Select]
$template_item = $site_template->parse_template("template_item"); And the html page would be template_item.html... But I know I'm missing some stuff.. or a lot????
Title: Creating Templates
Post by: Term on October 17, 2002, 06:30:43 PM
Nope I'm pretty sure that is wrong.. this is tricky for me! Hard to figure out. I keep looking through the code... and I know forsure the template item has to be included at the top for templates used... on each .php page..

linke index.php, categories.php etc. but i cant figure out exactly how to do it... someone should make a tutorial... im still new to php so i cant figure this out! :(
Title: Creating Templates
Post by: Jan on October 17, 2002, 06:33:46 PM
Code: [Select]
$template_item = $site_template->parse_template("template_item");
Will read the template into the variable $template_item. You have to register it now to the main template. Add just below this line:
Code: [Select]
$site_template->register_vars("template_item", $template_item);
You can now use {template_item} to show the content.

Jan
Title: Creating Templates
Post by: Term on October 27, 2002, 11:11:02 PM
I got that all to work but now when I try to use template code on that individual templates.. it doesnt work.

For instance I have a template now called about_us.html and when i put:

Code: [Select]
{header} and
Code: [Select]
{footer}

on that template it doesn't display the header.html, it displays
Code: [Select]
{header}

What do I gotta do now and in what file?
Title: Creating Templates
Post by: Term on October 27, 2002, 11:41:26 PM
On index.php i added:

Code: [Select]
//-----------------------------------------------------
//--- About Us ----------------------------------------
//-----------------------------------------------------
$about_us = $site_template->parse_template("about_us");
$site_template->register_vars("about_us", $about_us);


and then in the templates directory I added a file called about_us.html

Then I LINK to about_us.html from the home.html template.

Now on the about_us.html template I got pretty much the same template 4images comes with so it has many
Code: [Select]
{these} things...

But my problem is on about_us.html none of them are parsing... What do I do?
Title: Creating Templates
Post by: Term on October 27, 2002, 11:53:05 PM
It seems like I asked this question poorly.

You gave me code to make a new
Code: [Select]
{thing} to be able to call it already in a template... I wanted to know how to make a new template altogether.

Such as about_us.html
Title: Creating Templates
Post by: Term on October 28, 2002, 06:12:42 AM
Help . . .  . . .    :cry:
Title: Creating Templates
Post by: Term on October 28, 2002, 06:57:29 AM
oh my gosh this is so impossible!!!!  :cry:

Ive looked through so many files.. EVERY FILE... and tried everything that i know to try....

SOMEONE... help me?

Jan? Please....  :oops:

Sorry... im desperate... I needa get this site up :)

Thanks so much for the support ANYONE!!!

 :D
Title: Vacation
Post by: Chris on October 28, 2002, 03:28:38 PM
FYI:

If you read the "announcements" forum, you'll note that Jan is on vacation this week.
Title: Creating Templates
Post by: Term on October 28, 2002, 04:28:36 PM
Oh... and thanks to all the other php coders that so eagerly want to help...

thanks for that news...
Title: Would if I could
Post by: Chris on October 28, 2002, 04:44:42 PM
Hey.  Gimme a little credit and look at the NUMEROUS posts I've made to help others.  If I had any info which I thought would help, I wouldn't hesitate to reply.  In this case, I just don't have any answers and maybe nobody else does either.  What you're trying to do isn't that straightforward and I don't recall anyone else trying this in the past.  

All I was trying to say is that this thread might just have to wait for Jan to get back.

Sorry.   :roll:
Title: Creating Templates
Post by: Term on October 28, 2002, 04:52:24 PM
yeah... thanks... i didnt mean to offend you or make a remark towards you personally :)

I am just so frustrated and I don't see why just placing a file in the templates directory wouldn't work... It's so wierd... I've searched all the code and although i'm a noviss php coder it looks like all the code does is read whats in that directory with a .html and parses it. So why isn't it working? I dunno.

Thanks for the information though vivid...
Title: Creating Templates
Post by: Term on October 30, 2002, 06:51:58 AM
Since I don't understand dutch.. or german... or whatever is used on this site... I couldnt read that post Jan made about vacation.. does anyone know when he/she is returning?
Title: Double language post
Post by: Chris on October 31, 2002, 03:19:50 AM
Ummm, let's see...
Quote
[German text]
-----
I'm going to vacation the next week. No question will be answered by me during this time.

Jan

He's going on vacation next week which is now, this week.  So since he won't answer questions during this week, my guess is that he's returning next week and will probably resume answering posts then.

Looks like english to me  :wink:  Okay I was being a smartass, but you should know that Jan always posts general announcements in both German and English.
Title: Creating Templates
Post by: Term on November 02, 2002, 12:08:26 PM
I swear I seen that post.. read it... and it was ONLY in german.... I guess I looked to quick.
Title: Creating Templates
Post by: Term on November 04, 2002, 05:52:54 PM
Hey...

Anyone got a cure for my problem yet? I really need help here   :cry: :(

Thanks anyone.. someone... you! :)
Title: Creating Templates
Post by: Jan on November 04, 2002, 06:22:27 PM
Maybe you're looking for that: http://www.4homepages.de/forum/viewtopic.php?p=5103#5103

Jan
Title: Look here
Post by: Chris on January 06, 2003, 04:17:31 AM
Quote from: Term
Then I LINK to about_us.html from the home.html template.

Now on the about_us.html template I got pretty much the same template 4images comes with so it has many
Code: [Select]
{these} things...

But my problem is on about_us.html none of them are parsing... What do I do?

I think this would take care of what you're trying to do.  Just supply the template name in the URL of your link in home.html like so:
Code: [Select]
http://www.YourDomain.com/index.php?template=about_us
4images accepts the "template=" and takes care of adding ".html" to about_us and looks for a file called "about_us.html" in the current template directory.  If it's found, it's processed.
Title: Re: Creating Templates
Post by: ascanio on March 10, 2006, 05:48:20 PM
This is what I always do and is very helpful to maintain it organize

open includes/page_header.php

before the
Code: [Select]
?>
add this
Code: [Select]
//---------------------------------------------------------------------------------------------
//---- New template {these}  --------------------------------
//---------------------------------------------------------------------------------------------

$these = $site_template->parse_template("these");
  $site_template->register_vars(array(
    "these" => $these
  ));
  unset($these);
now you can add {these} to any template

and you need to create a these.html template


Title: Re: Creating Templates
Post by: V@no on March 11, 2006, 01:53:01 AM
usingin v1.7 dont you?
since v1.7.1 your method will not work, the template parsing must be done AFTER registering the tags ;)
Title: Re: Creating Templates
Post by: ascanio on March 11, 2006, 02:17:10 AM
im using 1.7.2 :) and it works perfectly :) :D
Title: Re: Creating Templates
Post by: V@no on March 11, 2006, 07:40:18 AM
usingin v1.7 dont you?
since v1.7.1 your method will not work, the template parsing must be done AFTER registering the tags ;)
^
stupid :oops:
overlooked what was actualy registering as a tag...
Title: Re: Creating Templates
Post by: Beautiful Body Castings on June 14, 2006, 03:41:51 AM
i can offer people template creation to fit with your existing site all i need is a copy of the default templates or the modified ones your using (header and footer only)

and a copy of one of your standard site pages with out any main content just a word like content where u wish the gallery stuff to be in relation to other elements on the screen etc

Michael