Jump to content

Php load from other file


nofishing

Recommended Posts

I want to load some options in my menu from an other php file. Now i have

 

$general="
<li><a href=\"index.php?a=player/news\">Home</a></li>

";

 

But now i want to add this in the $general part

 

<? if($data->login == $admin || $data->admin == 1) { ?>	 
                                
<div class="menu-item-left"><img src="images/arrow.jpg"><a href="index.php?a=admin/admin"><font color="#000000"><b>Administrator <img src="images/icons/accept.png" border="0"></b></font></a><img src="../seperator.jpg" class="sep"></div>
                
                <?php } else { ?>           
				<?php } ?>	

 

Some one know how i can do this?

 

And also i have the same problem at this part

 

(but this isnt working)

 

[code]$moderncrimes="
<li><a href=\"index.php?a=player/modernnews\">Home</a></li>
<li><a href=\"index.php?a=crimes/training\">Trainingen</a></li>

print <<<ENDHTML

// estimate the number of rows in a table | Select random player to attack
$lekerdezes = mysql_query("select * from `users`");
$max = mysql_num_rows($lekerdezes);

// pick one
$rand = rand(1,$max);

$lekerdezes2 = mysql_query("select * from `users` WHERE id='".$rand."'");

while($rand == $data->id){
$rand = rand(1,$max);
}

ENDHTML;

<li><a href=\"index.php?a=crimes/attack&x=<?echo$rand;?>\">Random attack</a></li>

";

[/code]

Link to comment
Share on other sites

for your first question, you can concatenate your $general variable i.e.

$gallery = "lorem";

if($next_word == "ipsum")

{

$gallery .= " ipsum<br />";

$gallery .= "<a href=\"http://www.domain.com\">lorem ipsum</a>"

}

echo $gallery;

 

fopr your second question, rather then run 2 queries why dont you run something like this

select * from users order by rand() limit 1

 

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.