Author Topic: [Arrays-Tutorial] - How to register new / additional arrays.  (Read 9933 times)

0 Members and 1 Guest are viewing this topic.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
[Arrays-Tutorial] - How to register new / additional arrays.
« on: January 07, 2006, 02:02:57 AM »
Greetings,

This tutorial is about using the arrays in the right way (basically speaking - for 4images coders).

For instance :

Quote

$site_template->register_vars(array(
"test" => $lang['test'],
"test1" => $lang['test1'],
));


This will allow you to register each new tags and use them like these :

Quote

{test}
{test1}


in your appropriate HTML template file.

Another way to do it would be like this :

Code: [Select]

$site_template->register_vars("test", $lang['test']);
$site_template->register_vars("test1", $lang['test1']);


(depending on the circomstances).

[Update - 10-01-2006]

Then, from your related HTML template files, you can use :

Code: [Select]

{if test}{test}{endif test}
{if test1}{test1}{endif test1}


Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Arrays-Tutorial] - How to register new / additional arrays.
« Reply #1 on: January 07, 2006, 03:23:28 PM »
only with this tutorial ... we understood ...  8)
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Arrays-Tutorial] - How to register new / additional arrays.
« Reply #2 on: January 07, 2006, 04:24:19 PM »
I'm ... not sure I get your point. Could you elaborate that a little ?

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Arrays-Tutorial] - How to register new / additional arrays.
« Reply #3 on: January 09, 2006, 12:51:15 PM »
Update :

It would seems I was mistaking in this topic. The first example, regarding the red comma, is tolerated anyway since lang/<your_lang>/admin.php - where the $setting strings are - already uses comma from each last lines (and, yes, from each different arrays).  :oops:

My topic has been updated above.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Arrays-Tutorial] - How to register new / additional arrays.
« Reply #4 on: January 11, 2006, 02:04:31 AM »
Update :

The {if ...} and {endif ...} sample has just been added in the tutorial. ;)

Offline Sun

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: [Arrays-Tutorial] - How to register new / additional arrays.
« Reply #5 on: July 10, 2009, 02:19:36 PM »
I use 4images 1.7.6.
I need to show some menu only for admin or registred users.
Does 4images have some standart arrays which i can use for this? Something like {if admin} or {if regestred}.

Thank you.

Tatyana.
I use 4images v.1.7.6
You can answer me in English and Russian languages.
Sorry, my English is not very good.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Arrays-Tutorial] - How to register new / additional arrays.
« Reply #6 on: July 10, 2009, 03:49:35 PM »
Yes it does.
{if is_admin}...{endif is_admin}
{if user_loggedin}...{endif user_loggedin}
{if user_loggedout}...{endif user_loggedout}
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)