Jump to content

Question(I think about arrays)


Unholy Prayer

Recommended Posts

It's an associateive array.  In java they inherit from the java.util.Dictionary class which is kind of a good way to think about them.  You have a key (think word) and a value think (definition).  This allows you you to do things like this:

 

<?php
$dictionary = array('bird' => 'Something that flies', 'dog' => 'something that barks');
echo $dictionary['dog'];
// prints: something that barks.
?>

 

Best,

 

Patrick

Link to comment
Share on other sites

Ok, So how do I get something like {SITE_NAME} to display a string that gets the site name from a database?  If my code is

 

$settings = mysql_query("select * from ubs_settings where id=1");

 

while($s=mysql_fetch_array($settings))

{

 

 

  $sitename=$s["sitename"];

  $slogan=$s["slogan"];

 

}

 

how would I make {SITE_NAME} to display $sitename?

 

Link to comment
Share on other sites

From my understanding writing MODs for phpbb, you have to have the tpl files included, using a function.  I wrote a mod that will display the user's theme next to their post in viewtopic.php, I added this to the associative array:

 

'POSTER_THEME' => $poster_style,

 

Then, in the tpl file, I added this where I wanted the theme name to appear:

 

{postrow.POSTER_THEME}

 

postrow was the name of the array.  I don't know anything about how to associate the template file and the associative array, I'm sure other people here do though.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.