Activate button

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shadi4J
Forum Newbie
Posts: 2
Joined: Thu Jun 12, 2014 1:48 am

Activate button

Post 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?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Activate button

Post 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.
Shadi4J
Forum Newbie
Posts: 2
Joined: Thu Jun 12, 2014 1:48 am

Re: Activate button

Post by Shadi4J »

so any suggesting ???
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Activate button

Post 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.
(#10850)
Post Reply