Author Topic: How to add more Template Pages ?  (Read 18298 times)

0 Members and 1 Guest are viewing this topic.

Offline CRego3D

  • Pre-Newbie
  • Posts: 5
    • View Profile
How to add more Template Pages ?
« on: October 08, 2002, 11:15:14 PM »
Can anybody tell me where do you set the functions for explate that says {whos_online} = templates/defaut/whos_online.html ?

I am trying to add new template pages :)

Offline Term

  • Newbie
  • *
  • Posts: 31
    • View Profile
How to add more Template Pages ?
« Reply #1 on: October 28, 2002, 04:49:15 PM »
http://www.4homepages.de/forum/viewtopic.php?t=2292

In here Jan tells us how to do that. It will work to do what you want but this does NOT make you able to create a wholenew template page all together. Something I'm trying desperately to figure out.

It's really simple actually. For the sake of being nice I'll just tell you now incase you might get confused in that other thread.

in index.php right befor:
Code: [Select]

//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------


add:

Code: [Select]

//-----------------------------------------------------
//--- your_template_item -------------------------------
//-----------------------------------------------------[/
$your_template_item = $site_template->parse_template("your_template_item");
$site_template->register_vars("your_template_item", $your_template_item);



Replace your_template_item with whatever name you want for your:

Code: [Select]
{your_template_item}

Then upload a file called your_template_item.html (remember to use the name you decided) to the templates directory and chmod it 666.

You can now use {your_template_item} on any of the standard templates that came with 4images.

Just place the tag on there where you want it. I'm not sure this is the best way. But it worked for me.

Offline sprokop

  • Newbie
  • *
  • Posts: 25
    • View Profile
This works for me as well
« Reply #2 on: November 01, 2002, 05:26:08 AM »
Thanks,

I'd like to take this up a notch by using the language packs. What do I need to add in order to change template function of the language?

Thanks
Sam
 :wink:
--
   __O
 _-\<,_     Why drive when you can bike?
(_)/ (_)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
URL
« Reply #3 on: November 01, 2002, 02:39:37 PM »
Just add
Code: [Select]
?l=<language pack>
to the URL.  So if you have the language pack "english" installed, this becomes:
Code: [Select]
?l=english

Offline sprokop

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: URL
« Reply #4 on: November 03, 2002, 06:29:36 AM »
Quote from: Chris
Just add
Code: [Select]
?l=<language pack>
to the URL.  So if you have the language pack "english" installed, this becomes:
Code: [Select]
?l=english


Thanks that works.

Now, what if I want to add text to the templates, I need to also provide for the translated version  of it. I see that all the translation is held under the lan>[language pack]>main.php, but when I try to add some variables in main.php and call it from the templates it doesn't work.

for instance I added {lan_welcome} in home.html and then added  to lan>french>main.php this
 $lang["welcome"] = "[bonjour]";

Now when I call the gallery home page with the  '&l=english' parameter it doesn't work :?:  I know I am missing a step but I can't figure it out. The variable doesn't get initialized or {lan_welcome} doesn't get processed?

Can you help? thanks
--
   __O
 _-\<,_     Why drive when you can bike?
(_)/ (_)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Close
« Reply #5 on: November 03, 2002, 05:29:37 PM »
Try {lang_welcome} instead

It's always "lang", not "lan".

Offline sprokop

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Close
« Reply #6 on: November 03, 2002, 06:13:23 PM »
Quote from: Chris
Try {lang_welcome} instead

It's always "lang", not "lan".


Actually my last post had a typo. I do have {lang_welcome} :(

Do I need to update any other pages besides the template I want to use the new text in and the main.php of that language pack? for instance if I am adding to  home.html template, do I need to ad something to index.php? I am at a lost! the syntax I used is the exact same as found throughout. Could it be that lang_welcome is used somewhere else? I have tried with something else but to no avail.

Thanks for your help
Sam
--
   __O
 _-\<,_     Why drive when you can bike?
(_)/ (_)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: URL
« Reply #7 on: November 06, 2002, 02:53:21 AM »
Quote from: sprokop
Now, what if I want to add text to the templates, I need to also provide for the translated version of it. I see that all the translation is held under the lan>[language pack]>main.php, but when I try to add some variables in main.php and call it from the templates it doesn't work.

for instance I added {lan_welcome} in home.html and then added to lan>french>main.php this
$lang["welcome"] = "[bonjour]";

You have to register the new lang name-value pair in the php file that is responsible for outputting the html template in question.  And if you want your new lang value on every page, you must add it to includes/page_header.php like this:
Code: [Select]
// Replace Globals in $lang
$lang = $site_template->parse_array($lang);

$site_template->register_vars(array(
  "lang_site_stats" => $lang['site_stats'],
  "lang_registered_user" => $lang['registered_user'],
  "lang_view_cart" => $lang['view_cart'], // My custom language replacement

Offline sprokop

  • Newbie
  • *
  • Posts: 25
    • View Profile
How to add more Template Pages ?
« Reply #8 on: November 06, 2002, 04:01:28 AM »
Thanks Chris,

It worked perfectly. I can't wait to dive into the whole slew of templates and finish up the French translation. Right now I am adding some custom welcome messages and other greetings.

I guess my next thing is that I would like to be able to add a field to the database and tie it up to the existing category name! this way I can enter the translated version of my category name without having to enter it all in one field. I guess the problem is then what if there is more than one language packs?? hummmm what do you think?

Sam
--
   __O
 _-\<,_     Why drive when you can bike?
(_)/ (_)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Future?
« Reply #9 on: November 06, 2002, 05:37:13 AM »
Sounds like you're venturing into uncharted waters.  I know you can add custom user and image fields using includes/db_field_definitions.php but I've never heard of anyone trying to extend it to categories.

Offline sprokop

  • Newbie
  • *
  • Posts: 25
    • View Profile
How to add more Template Pages ?
« Reply #10 on: November 06, 2002, 05:55:59 AM »
Yeah that's next level stuff! though it would be an excellent addition to the software! I think that like me, many other people who want their gallery to be fully bilingual would find this feature very very usefull.

I am sure there is a hack way of doing it, like I could register the coresponding lang_* variables and parse them when calling categories.html but that means entering every one of them in three different places, and possibly more! (all language packs, somepage.php and someTemplatePage.html). I guess that could work.

Tying the thing to the admin and the db is obviously the way to go. I guess it's time to hit the PHP books !! 8O

Sam
--
   __O
 _-\<,_     Why drive when you can bike?
(_)/ (_)

Offline police22

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • The Dartez Page
Re: How to add more Template Pages ?
« Reply #11 on: April 28, 2005, 07:13:43 AM »
Wow.. this is very usefull.. what i was looking how to do..
Thanks Chris :wink:

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: How to add more Template Pages ?
« Reply #12 on: April 28, 2005, 02:34:38 PM »
Any thanks, even 2.5 years later, is always appreciated.

Offline police22

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • The Dartez Page
Re: How to add more Template Pages ?
« Reply #13 on: April 28, 2005, 06:29:42 PM »
Any thanks, even 2.5 years later, is always appreciated.
:lol: @ Chris.. well i just thought of doing it and was just wondering about it and finaly did a search... :lol: :oops: :roll: hehehehe.