/    Sign up×
Community /Pin to ProfileBookmark

CCS & Navigation Bar

Hi

New guy, I have created my web page format using css. I have a page which is my template format colors, text info etc saved as css. I created a seperate page with the links to my webpage. how do I get this so that it shows on everypage. (making the links part of my foramt

to post a comment
CSS

15 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelMar 05.2006 — There is a *php code for that, -saw it posted here not too long ago. I copy & saved it, was going to go over it and try it myself. Basically, you create your 'navigation links' on an html document (with no other content) and save it as a php file, and in/on all HTML pages of your site that you want those links to be, you insert a referancing link back to that php page, which puts 'the navigation links' where you placed the citation (I am sure that I am not explaining this correctly).

Essentially, it is akin to how a external *
css file, written once, is inserted into any html-page via referancing link... sweet! I have to learn *php now, too!!

Try the php forum...

-Joel
Copy linkTweet thisAlerts:
@kprocauthorMar 05.2006 — Can I set an internal link to my webpage so that it opens another page.

What I'm trying to do is reference my menu page to the rest of body of the page

On the left hand side there is a menu list and on the right is the body of the page

I have tried this

<div id="menu">

<a href="Master.html"></a>

</div>

When the page is opened I want it to run the link to the menu page. (work like frame would)
Copy linkTweet thisAlerts:
@tubaplaya76Mar 05.2006 — if you can use php:

[code=php]
<?php

include("links.php");

?>

[/code]


just place it where you need.
Copy linkTweet thisAlerts:
@kprocauthorMar 06.2006 — I know nothing about PHP, where is the best place to fo for a dummy and get started
Copy linkTweet thisAlerts:
@pcthugMar 06.2006 — http://www.zend.com/php/beginners/

and you may also be interested in installing PHP on a local machine

http://www.apachefriends.org/en/xampp.html
Copy linkTweet thisAlerts:
@kprocauthorMar 06.2006 — I'm starting to think that I'm getting in over my head.

I started creating a webpage using frames and learned that was a bad idea. My though wa that it would be easy to create a navigation (menu) bar down the Left Side of the page and seperate the header. I later learned that frames is not a vary favoritable means for creating a web page. and that the norm is to us CSS. I have started redoing my web page using CSS, but know I learn that I have to learn PHP if I want to have my "navagation / menu bar be consistant for each web page.

Is there a away that I can have my menu bar on all my page. The left side being menu bar and the top being the header using CSS.

thank you
Copy linkTweet thisAlerts:
@frupMar 07.2006 — or you could use javascript. its ugly and search engine wont like it but it will do the job....

for each line of HTML you will need to go
[code=html]
print ' <li><a href=yourpage>link</a></li> ';
...
[/code]

then save it as menu.js

then on your main HTML page go
[code=html]
<script src=menu.js></script>
[/code]


now that might have errors because i dont use much JS and its been a long time since i used that system... but it does work

oooh and no HTML formating in the JS file other than the links, eg no body or html tags... they will be added to your page by javascript
Copy linkTweet thisAlerts:
@pcthugMar 07.2006 — [B]server-side includes?[/B]

<!--#include virtual="path/to/links.html" -->
Copy linkTweet thisAlerts:
@kprocauthorMar 07.2006 — HI PCthug

Can you tell me more about your post, don't really understand what you posted.

frup, thankyou for the information
Copy linkTweet thisAlerts:
@kprocauthorMar 07.2006 — I have a phpbb forum set up on my webpage, does that count as having php installed on my web server.

how would I test it or add to it
Copy linkTweet thisAlerts:
@frupMar 07.2006 — yes it probably does

make a file called *.php (* being anything incase you don't know)

in it put
[CODE]<? phpinfo(); ?>[/CODE]

upload that to your webserver (or if your lucky like me to localhost ?) and then open the file from http.. it should have a huge tabled list of everything thats installed for PHP/versions/tunred off/on blaah blaah blaah
Copy linkTweet thisAlerts:
@frupMar 07.2006 — [code=php]
<?php

include("links.php");

?>
[/code]

will then do the job... it basically includes *.php (or *.*) in to your page with the code on it... if you were to look at the source it would look like 1 html page... you can include as many pages as you want (so you could make a header/footer/right nav/left nav and just have the middle for content...

but this is my favourite way (this is my favourite piece of PHP)

...

OMG i just realised that on my last format i copied the wrong folder over and lost all my web designs and codes for the last 5 years! ****!
Copy linkTweet thisAlerts:
@kprocauthorMar 08.2006 — I confirmed that, server supports php. how do I creat the page with all the links and can I apply css to a php page. I know very rookie questions
Copy linkTweet thisAlerts:
@frupMar 08.2006 — [code=php]
<?
if (isset($page)) { // check i var page is set
if (file_exists($page.php)) { // check if $page .php exists
include($page.php); // include the file (add it to your page)
}
else {
include(404.php); // if page doesnt exist 404 error (instead of PHP error)
}
}
else {
include(news.php); // default (eg with out going *.php?page=*)
}
?>
[/code]

that might not work. (i lost all my saved scripts when i formated last week ? ).. but if you put that in the middle of your page and then it will open news.php by default and then you change your template to have no content in the middle.... and save your content as for example content.php and then open it by going
[code=html]
<a href=index.php?page=content>OPEN CONTENT</a>[/code]


that could be wrong because i havent tested it (i just wrote that now and im not at home to test it on my server)
Copy linkTweet thisAlerts:
@frupMar 08.2006 — im sorry that was really bad php :o

[code=php]
<?

$page = $_GET["page"]; // get var page from address
$file = $page.".php"; //var file = $page.php
if (isset($page)) { // check if var page is set
if (!file_exists($page.'.php')) { // check if $page .php exists
$file = '404.php'; // doesnt exist... add 404
}
else {
$file = $page.".php"; // exists continue to include
}
}
else {
// default, $page is not set (eg with out going *.php?page=*)
$file = 'news.php';
}

include ($file); // include the file to your page

?> [/code]



THERE!!! lol... i wrote that myself ? common script though i believe... one of the most usefull php ones i wreckon... you can edit heaps... can even have your content in HTML or TXT or whatever files... as its included as HTML inside index.php

to test this go like this:

index.php (this has this code on it with HTML around it)

news.php (just put news.php in it nothing else)

404.php (add 404 message like cannot be found)

make a random named page like content.php inside this put content.php

open index.php ... it should say news.php

open index.php?page=content ... should say content.php

open index.php?page=404 ... should say 404 message

open index.php?page=somepage that doesnt exist ... should display 404

you can use heaps of these on your page (so you could have different menus or images or whatever

index.php?page=1&image=2 is how you would use it then (& linking in the second variable)

you could make this really big and complicated if you want... it could possibly be made smaller too<?

$page = $_GET["page"];

$file = $page.".php";

if (isset($page)) { // check i var page is set

if (!file_exists($page.'.php')) { // check if $page .php exists

$file = '404.php'; // include the file (add it to your page)

}

else {

$file = $page.".php"; // if page doesnt exist 404 error (instead of PHP error)

}

}

else {

// default (eg with out going *.php?page=*)

$file = 'news.php';

}

include ($file);

?>
×

Success!

Help @kproc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...