23 replies [Last post]
u66lan
Offline
Regular
Last seen: 12 years 45 weeks ago
Joined: 2007-09-05
Posts: 20
Points: 0

I've just finished the basic positioning on my site. Now comes the fun - the linking. Which is the best way to make links to different pages on your site. I don't want an iframe just regular links. Let's for eg. say I have a div-tag named "main" where all the information will be displayed. So when i press the links: news, images, etc. it's supposed to show the information in that div. One way of doing it is by creating all the pages: news, images etc. and copy paste all the basics (positioning, bgcolor etc) from the index.html in the new pages and write the specific information on each page. But, isn't there really a better way of doing this?

Thank you for your time.

Triumph (not verified)
Anonymous's picture
Guru

Hmm. What exactly is your

Hmm. What exactly is your question? :?

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 3 years 4 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

i tend to use <a

i tend to use

Home
Contact Me
About Us

etc... or have i misunderstood?

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

Jeff.tet
Offline
Regular
Last seen: 12 years 24 weeks ago
Timezone: GMT-5
Joined: 2007-09-21
Posts: 25
Points: 0

Or something like this: <a

Or something like this:

Home Images News

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 3 years 4 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

Your way is a reasonable

Your way is a reasonable method, but tends to give search engines trouble

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

u66lan
Offline
Regular
Last seen: 12 years 45 weeks ago
Joined: 2007-09-05
Posts: 20
Points: 0

frame

Im sorry if my question was indistinct, english isn't my nativ language. Anyways, i'll try again Smile. In my menu-div i have links within my site to pages like News, Home, Images etc.. When i press a link it's supposed to be displayed in the main-div where all the pages will be shown. If I understand correctly I can't link to another div? But if I create a frame inside the main-div I can link stuff in here right, is this a good way of doing it? How would you do it?

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

'Frames' are a largely

'Frames' are a largely redundant concept now. You could use Iframes but they also are no longer favoured that much. The usual advice is to look into 'Includes' SSI or PHP includes

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

u66lan
Offline
Regular
Last seen: 12 years 45 weeks ago
Joined: 2007-09-05
Posts: 20
Points: 0

Since I created the page

Since I created the page with html and CSS is it really a good idea to start with php now? The thing is, I don't know anything about php Tongue

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Then you would run with

Then you would run with Server Side Includes' SSI

PHP includes are not difficult though as long as your server has the PHP engine running then it's a simple matter of changing your file extension to .php and in your page that was .html would be a line calling in the html snippet e.g:

<?php include('menu.php'); ?>

The rest of the work is done for you, apart from cutting out the markup to a new file.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

LukeDouglas
Offline
Regular
Alabama
Last seen: 12 years 46 weeks ago
Alabama
Timezone: GMT-5
Joined: 2005-12-10
Posts: 21
Points: 0

PHP advice

The decision to learn PHP is basically a decision to how you want to change information on the pages you are developing.

If you develop static websites for clients, then every time they want something changed, they have to send it to you, you have to modify the page and then upload it to the website. That's kind of silly if they wanted to change a phone number, address or some textual content. It would be better to have an admin section where they can go in and change what is on the website and let you maintain the framework.

If you are going to store data in a backend database such as MySQL, then learning PHP would be worthwhile. If you do a search on Google for 'php mysql', you'll find tons of reference information.

I didn't buy a PHP development book as I came from an application development career and the transition for me was really painless. If you don't know anything about databases (yea, they're called tables now) and making database information usable on websites, then get a book on PHP / MySQL development and learn it.

Remember, the good thing about PHP is that it is basically hidden so that what users see is just the web page. Look at this area below a forum post and you will see this instruction.

You may post code using ... (generic) or <?php ... ?> (highlighted PHP) tags.

This website is using PHP. Although I can't see it directly, I'm pretty sure the forum post titles on the left side, the forum posts themselves, user profile information and everything else that is dynamic on this website is maintained in a database, probably MySQL, although there are others that could be used.

This site is well structure, attractive, easy to use and it delivers on it's purpose. To provide a way for people to communicate, exchange ideas and help each other.

A lot can be learned from this website just by looking at it.

Just another old hacker impersonator!!!

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

The forum is PHP/MySQL, in

The forum is PHP/MySQL, in actual fact it is using the Drupal CMS/portal engine.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

u66lan
Offline
Regular
Last seen: 12 years 45 weeks ago
Joined: 2007-09-05
Posts: 20
Points: 0

msn

Thank you guys for the replies! I've kinda decided to give PHP a try.. again. Last time I got lost somewhere in the beginning about the server-configuration :shrug:. I've already started to read the basics, but it would be great if we could have a conversation in real time :blushing:. So if someone would like to help me even more it would be very generous of you if we could have a chat on MSN. Again - thanks guys!

u66lan
Offline
Regular
Last seen: 12 years 45 weeks ago
Joined: 2007-09-05
Posts: 20
Points: 0

Wow, I just spent the whole

Wow, I just spent the whole day studying php Smile. Now i have an Apache webserver up running with php installed. So could someone explain more deeply how to use the "include command" in the way i described above.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

See it's not that hard and

See it's not that hard Smile and now you have a fully blown dev server with DB and PHP.

I did sort of explain earlier how to use php includes; briefly to expand a tad:

Your include file would consist of this:

menu.inc.php

it is called into the page as I described earlier, you place the include call at the position that you would expect to see the html markup.

PHP files are parsed first and any instructions read and carried out, the include simply gets read and is instructed to dump it's contents at the point it occupies.

remember to name your main file with the include as .php rather than .html

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

u66lan
Offline
Regular
Last seen: 12 years 45 weeks ago
Joined: 2007-09-05
Posts: 20
Points: 0

Hmm I must be stupied or

Hmm I must be stupied or something Hugo but I seriously still don't understand :bigoops:. I took a snapshoot of the page and drew the divs to illustrate my intention. Can the include command achieve this? Thanks Smile

AttachmentSize
include.gif 150.48 KB
thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 21 weeks 10 hours ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Yes. Create a new file,

Yes.

Create a new file, called "menu.inc"

In it put JUST the HTML code for the menu, as Hugo posted above.

Then, in your main page, instead of manually adding the UL code, use the include function to pull it in.

Verschwindende wrote:
  • CSS doesn't make pies

u66lan
Offline
Regular
Last seen: 12 years 45 weeks ago
Joined: 2007-09-05
Posts: 20
Points: 0

Thanks for the reply. I

Thanks for the reply. I think I know how it works now, still I have come across problems. When I apply the include-command where the menu is the menu-div get completely clean except for the size and background. A little box saying "php" appears in the top left corner. Everything works when i try it on the server but it is still pretty annoying not being able to see the text on the site. Can I solve this in any way?

AttachmentSize
Untitled-1.gif 125.32 KB
sticks464
Offline
Enthusiast
Topeka, KS.
Last seen: 8 years 37 weeks ago
Topeka, KS.
Timezone: GMT-6
Joined: 2006-10-18
Posts: 116
Points: 71

This is what makes includes

This is what makes includes so great. You only have to edit the menu on one page for it to change on all pages. To stop any annoyance of visibility, I first create all my pages normally and just before uploading I change the parts that I want to be included by copying and pasteing
code to the page to be included, inserting the includes command on each page as I delete the code on each one. I then view it on my server and make any changes as necessary. Once you get use to it, it really doesn't add much more time to design.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 13 hours 52 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9761
Points: 3843

u66lan wrote:<snip> When I

u66lan wrote:
<snip>
When I apply the include-command where the menu is the menu-div get completely clean except for the size and background. A little box saying "php" appears in the top left corner. Everything works when i try it on the server but it is still pretty annoying not being able to see the text on the site. Can I solve this in any way?

First things first, don't view the page in DW. It is not a browser. Use Firefox as your primary testing browser, then check others to compare renderings. For the most part, you can assume the Firefox rendering is the correct one.

Have you installed Apache, MySQL and PHP on your development box? You should. You want to have a working server as your development environment. Then, you simply save your files to the server and GET them by the browser.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

u66lan
Offline
Regular
Last seen: 12 years 45 weeks ago
Joined: 2007-09-05
Posts: 20
Points: 0

Ofcourse you can't use DW as

Ofcourse you can't use DW as a browser but there's isn't a design-window for no reason. In my opinion it should show the includes and not just an annoying php-box. Another annoying thing with the includes is the the code in the include files (.inc) is just plain gray, not as in html/php etc. with coloured tags. And when you write code in it, it doesn't pop up any drop-down menu helping you write the code. Any idea to fix this?

Another question about rollovers.

in my index file I have all the divs placed. In the menu div we have the include menu.php tag which points the div to the menu.inc.. In the menu.inc file i have an unordered list with several links, for eg.

. Now I want a rollover instead of the "News" text string. I've created two images one before the rollover and one after.
In the CSS I have the following code:
//.menu_news a {
background:url(../images/nav/home.png);
width:110px;
height:90px;
}//
Somehow this doesn't work no image is shown. But if I remove the "a" from ".menu_news a" it does all in a sudden work. Where's the problem?

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 3 years 4 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

then name it nav.inc.php

then name it nav.inc.php

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

u66lan
Offline
Regular
Last seen: 12 years 45 weeks ago
Joined: 2007-09-05
Posts: 20
Points: 0

Thanks for the reply. So the

Thanks for the reply.
So the ".inc" isn't really needed? Well.. the ".php" solved the gray text. But the problem with the annoying php-box remains Tongue

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Your using DW (The weaver of

Your using DW (The weaver of Lies) :shrug:

Why would you expect it to be able to parse PHP files? is it meant to have this capability? generally you would need to access the file through a browser calling the file from a server such as Apache that has the PHP module installed, it's that and the server that runs the PHP file and returns the instructions contained within to the browser, DW is simply looking at static files and doesn't know what to do when presented with a PHP include.

We always say to never trust (preferably never use!) to DW preview mode.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

demonz_web
demonz_web's picture
Offline
newbie
Sydney
Last seen: 12 years 45 weeks ago
Sydney
Joined: 2007-08-13
Posts: 5
Points: 0

Hugo wrote:Your using DW

Hugo wrote:
Your using DW (The weaver of Lies) :shrug:

Why would you expect it to be able to parse PHP files? is it meant to have this capability? generally you would need to access the file through a browser calling the file from a server such as Apache that has the PHP module installed, it's that and the server that runs the PHP file and returns the instructions contained within to the browser, DW is simply looking at static files and doesn't know what to do when presented with a PHP include.

If you want to know if you have php on your server, run this -

<?php
print "

PHP is installed

";
?>

If "PHP is installed" doesn't come up on the page, PHP isn't installed. Remember if you are testing from a directory and you want to use PHP, you will have to do it through a webserver as it is an interpreted language - your web-hosting will probably have this. If you want to develop locally on Windows use http://www.wampserver.com/en/ - note: even when this is installed you will have to look at the page through the local server, which is usually at http://localhost (WAMP should tell you wehre it is) . If you get to this stage, the method for bringing the php file into the page will look like this -

MenuFile.html (conatins menu html) ---> Other Files (contain include)

The include looks like -

<?php
include "menu.php";
?>

OR

<?php
require "menu.php";
?>

You will always need to have php opening and closing tags as this is not a piece of html. What will happen now is that when the page is requested, the web server will read the php opening tags, read the code through the php interpreter and follow the programming instructions and then spit out html which is returned to the browser.

Enjoy

___

Aaron Newton, Demonz Media web design Sydney