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]
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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]
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.