Page 1 of 1

Activate button

Posted: Sat Jun 21, 2014 4:16 am
by Shadi4J
hey
i have a problem i am a new in php and i need help
i just did a pageclass and i put the buttons in it
the problem now is how i suppose to make each button get into activate mode or class
my code..

Code: Select all

public $buttons = array (
		                  "الصفحة الرئيسية" => "index.php",
		                  "من نحن" => "about.php",
						  "إجتماعات" => "meetings.php",
						  "عظات" => "sermons.php",
						  "مقالات" => "articlaes.php",
						  "صور" => "albums.php",
						  "الكتاب المقدس" => "bible.php",
						  "راسلنا" => "contact.php",
	);

$this->DisplayMenu($this->buttons);

public function DisplayMenu($buttons) {
?>

<div id="BannerBtn">
<ul>

	  <?php
	  foreach ($buttons as $title => $link)
         echo "<li><a href='$link' >$title </a></li>";
	?>
    </ul></div>
i tried to use this code

 <a href="$link" title="Welcome page" 
            <?php 
                if (
                    $page == '$link'
                ) { 
            ?> class="ActivePageName"<?php } ?>
            >$title</a>
<?php $page = basename($_SERVER['SCRIPT_NAME']); ?> this will be in each page

soo what you think?

Re: Activate button

Posted: Sat Jun 21, 2014 7:24 am
by Celauran
I think there's code missing. class isn't defined, opening braces without matching closing braces. Closing PHP tags in the middle of a function? Your DisplayMenu method seems to output HTML.

Re: Activate button

Posted: Sun Jun 22, 2014 3:42 am
by Shadi4J
so any suggesting ???

Re: Activate button

Posted: Mon Jun 23, 2014 4:01 pm
by Christopher
The code is not complete so we cannot offer suggestions.

If you want each button to have code associated with its events, then give each button a unique ID or Class name.