linstefoo Posted August 10, 2006 Share Posted August 10, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/17154-can-someone-help-me-make-this-work-ive-done-everything-i-can-think-of/ Share on other sites More sharing options...
Ninjakreborn Posted August 10, 2006 Share Posted August 10, 2006 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 itwhat do you want it to do in cordination with the above? Quote Link to comment https://forums.phpfreaks.com/topic/17154-can-someone-help-me-make-this-work-ive-done-everything-i-can-think-of/#findComment-72646 Share on other sites More sharing options...
linstefoo Posted August 10, 2006 Author Share Posted August 10, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/17154-can-someone-help-me-make-this-work-ive-done-everything-i-can-think-of/#findComment-72648 Share on other sites More sharing options...
linstefoo Posted August 10, 2006 Author Share Posted August 10, 2006 can anyone help me with this? I really need to get this working Quote Link to comment https://forums.phpfreaks.com/topic/17154-can-someone-help-me-make-this-work-ive-done-everything-i-can-think-of/#findComment-72731 Share on other sites More sharing options...
sasa Posted August 10, 2006 Share Posted August 10, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/17154-can-someone-help-me-make-this-work-ive-done-everything-i-can-think-of/#findComment-72744 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.