Re: Single Menu Page with Bv and PHP
Hi Chris,
no, you have not imagined it.
Here is the code:
<?
$file_to_include = $_SERVER['DOCUMENT_ROOT']."/include_path/menu.php";
include($file_to_include);
menu();
?>
This is the same code, but two additions:
1. $_SERVER['DOCUMENT_ROOT'] is ONE OF THE VALUES OF THE $_SERVER superglobal, that corresponds to /home/username/public_html/file_folder where file_folder is the folder that is calling the menu.php . Instead, include_path would be, the folder where you have published your file that needs to be included (menu.php)
If you have (as most of us) published the menu.php in your public_html (or, in case of addon, in the domain root directory), the voice "include_path" should be left out, and the command would become:
<?
$file_to_include = $_SERVER['DOCUMENT_ROOT']."/menu.php";
include($file_to_include);
menu();
?>
What i would like to point out here is that the code i have presented here, requires the menu (or other) to be defined as a function. The code in the pages calls the script, then it uses the command
menu();
to "display" the menu itself.
The reason i did so is that, with a minimum of php experience, the user can pass over to the included file, some parametrs and then call the function with
menu($par1, $par2, $par3, .....) . This way you can have a menu that behaves (read: displays) differently depending on the parametres passed over.
If you don't need this type of performance, the menu, header, etc, CAN BE SIMPLE BLUEVODA HTML PAGES, WITHOUT ANY CODE ADDED IN THE START OF PAGE AND END OF PAGE and ONLY THE CALLING PAGE NEEDS TO BE PHP.
In that case, the command could be simply
<?
include('menu.html');
?>
<?
$file_to_include = $_SERVER['DOCUMENT_ROOT']."/include_path/menu.html";
include($file_to_include);
?>
Please note that if your menu has buttons (images) you MUST set the relative path to these images or they will not display,
This is the reason i suggest that if you have this method for pages in different folders, it would be wise to publish the included page in all folders
Single Menu Page with Bv and PHP
Collapse
This topic is closed.
X
This is a sticky topic.
X
X
-
Re: Single Menu Page with Bv and PHP
Hi, I believe Naval posted a thread quite a wile back showing a way to link to the other php files in another folder/directory that would make the total page up. This was to save you having to place a (for argument sake) a php menu file in each of the sites folders/directory's.
Or am I imagining this.?????????????? "Naval!"
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
I reviewed all codes - they were correct. So I went radical: deleted everything and copied and pasted all over again. It works beautifully now. Thanks a lot.
Rosa
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
The code I used for header in all pages was: <? function myheader() { ?>
I've deleted the menu/header/textmenu codes from the index page. ( That's what I got from your reply to WSBlue : "In your index page the menu doesn't show because it retrieves the html page (you need to delete it) and not the php. However, you also have made some other mistake because you have inserted the menu code in that page too"). Now the index page shows up but the problem continues in the others. Should I include the codes in the index.php page as well?
Thanks,
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
It is obvious tha there is a mistake in the myheader page code.
Please post here the code in your "myheader" start of page
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
I've received the following error message when opening my site
Parse error: syntax error, unexpected '}' in /home/eynbvrar/public_html/myheader.php on line 18
I've been working with BV for a month now - had all pages published as html with no problem but decided to change them to php to enable single menu as per Naval instructions. Used the same process for the header and text menu. Now only the error message and the title of the article are visible - no sign of menu bar, text menu or the content of the page. I've been learning BV as I build the site - easier to see what works (or doesn't!). Watched the tutorials endless times and spent hours going through the forums looking for answers but without luck. Time to cry for help, I guess.
Thanks,
Rosa
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
Simply do NOT set any background in your menu.php page
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
I used this to design my menubar for every page and it worked great, however, my background is now white instead of green like it originally was on my index page. Do you know what would cause this? Am I supposed to make the background on the menu.php transparent, and how do I do that?
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
Use it for footers too. They don't float as such, but as you are building each page, just adjust your page length in the " page properties" and reposition (drag) the HTML box containing the footer, to the bottom of the page.
Tip: When you design your base page using this method, make sure you size the footer' html box to fit hard against left side of page. That way it's only a matter of sliding the box down the left edge when constructing a new page. Also, make sure after you have moved any elements (should only need to move footer), recheck your page width iin the properties. You could have slipped over a little and width will stay at the max width element caused during the move.
Rick
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
I figured out!!!! no more problems it works!!
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
My pages are of different length, can the footer be floating?
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
Originally posted by bishopjack View PostI learned a while back it is easier to work with a page template. The first thing I do is to build what I call my template page. It has all of the common elements without the bells and whistles of the indivdual pages. i save it as "template" and when I make a new page, I save that page by its proper name. I am famous for making mistakes as well. I have learned to copy and paste html, etc, as well....just an idea.
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
I learned a while back it is easier to work with a page template. The first thing I do is to build what I call my template page. It has all of the common elements without the bells and whistles of the indivdual pages. i save it as "template" and when I make a new page, I save that page by its proper name. I am famous for making mistakes as well. I have learned to copy and paste html, etc, as well....just an idea.
Leave a comment:
-
-
Re: Single Menu Page with Bv and PHP
anyone have much experience with the css tab designer program talked about earlier in this thread? mine seems to be invisible on preview... any ideas why?
Leave a comment:
-
Leave a comment: