Jump to content

Can someone help me make this work?:( I've done everything I can think of


linstefoo

Recommended Posts

I've got a question on how to make somthing work. I've got the following code:
[code]<?
  $navigation_menu['top']['Home']['url'] = "index.html"
?>[/code]

and then I got this code which outputs the menus
[code]<?
  foreach($navigation_menu['top'] as $name => $link) {
  echo "<a href=\"{$link['url']}\">{$name}</a>";
  }
?>[/code]

how do i get the following to work in coordination wiht the above and load the pages dynamically:
[code]<?
  if(is_array($VirtualPage))
    echo $VirtualPage['content'];
  elseif(file_exists("include/$Page.php");
    include("include/$Page.php");
?>[/code]
How can you make them work without even knowing how to format them correctly, change them to this.

[code]<?php
  $navigation_menu['top']['Home']['url'] = "index.html"
?>[/code]
[code]<?php
  foreach ($navigation_menu['top'] as $name => $link) {
  echo "<a href=\"{$link[url]}\">{$name}[/url]";
  }
?>[/code]
[code]
<?php
  if (is_array($VirtualPage)) {
    echo $VirtualPage['content'];
  }elseif (file_exists("include/$Page.php") {
    include 'include/{$Page}.php';
  }
?>[/code]
Now that I can actually ready it
what do you want it to do in cordination with the above?
I basically need the last chunck of code to read {$link['url']} and if it finds a file called index.php inside the include file load it for the index.php on the hompage. Else if the user clicks another link like "about us" it checks to see if an aboutus.php file exists in the Inlucde directory and loads it via the INCLUDE function.
try[code]
<?php
$navigation_menu['top']['Home']['url'] = "index";
foreach ($navigation_menu['top'] as $name => $link) echo "<a href=\"?page={$link[url]}\">{$name}</a>";
$Page=$_GET['page'];
if (file_exists("include/$Page.php")) include "include/$Page.php";
?>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.