PDA

View Full Version : Smooth Navigational Menu (external) with dynamic PHP



Icke
01-28-2011, 08:30 AM
1) Script Title: Smooth Navigational Menu (v1.5)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm

3) Describe problem: As on the developer page described I exclude the menu in an external file. I've tried to generate the links dynamicly with some short PHP (see below). As you can see it's just the page name itself, I want to dynamicly insert.

Code at the index.php


<?php
$url = basename($_SERVER['PHP_SELF']);
?>
<head>
...
</head>
<body>
...
</body>


The external php file


<div id="language_menu" class="ddsmoothmenu">
<ul>
<li><a href="#">Folder 0</a>
<ul>
<li><a href="<?php echo '../en/'.$url; ?>">Sub Item 1.1</a></li>
<li><a href="#">Sub Item 1.2</a></li>
<li><a href="#">Sub Item 1.3</a></li>
</ul>
</li>
</ul>
<br style="clear: left" />
</div>


As expected the skript does not what it should do (insert the variable). Are there any solutions for the problem? I'm not really familiar with AJAX (IMHO one way to solve the problem), maybe someone right here yould give me a hint.

The rest of the script does what it should.

Thank you very much.

ddadmin
02-01-2011, 05:10 AM
If the external file is in php format (.php extension), the server should parse it for any PHP code. Please post a link to the page on your site that contains the problematic script so we can check it out.