4images Forum & Community
4images Modifications / Modifikationen => Templates & Styles (Requests & Discussions) => Topic started by: CRego3D 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 :)
-
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:
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
add:
//-----------------------------------------------------
//--- 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:
{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.
-
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:
-
Just add
?l=<language pack>
to the URL. So if you have the language pack "english" installed, this becomes:
?l=english
-
Just add
?l=<language pack>
to the URL. So if you have the language pack "english" installed, this becomes:
?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
-
Try {lang_welcome} instead
It's always "lang", not "lan".
-
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
-
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:
// 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
-
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
-
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.
-
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
-
Wow.. this is very usefull.. what i was looking how to do..
Thanks Chris :wink:
-
Any thanks, even 2.5 years later, is always appreciated.
-
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.