Jump to content

help me for the index.php


nielcleo

Recommended Posts

hello guys im a newbie at php i need some help about the index.phpokay here's my problem.i want to have a mini portfolio and have index.php how should i do if i want to navigate my page like this urlmysite.com/index.php?gallerybecause if i navigate my page if ill go to gallery the url looks like this mysite.com/gallery.phpcan anyone help me?hope u get my point guys sorry for my poor english..

Link to comment
Share on other sites

looks like the content is produced dynamically to one page (index.php) from mysql table depending on url, similar to joomla.samething can be reproduced using<a href="index.php">Home</a> | <a href="index.php?gallery">Gallery</a><?phpif(isset($_GET['gallery'])){?><h1>Gallery page</h1><p>Gallery content</p><?php}else{?><h1>Home page</h1><p>Home Page content</p><?php}?>

Link to comment
Share on other sites

looks like the content is produced dynamically to one page (index.php) from mysql table depending on url, similar to joomla.samething can be reproduced using<a href="index.php">Home</a> | <a href="index.php?gallery">Gallery</a><?phpif(isset($_GET['gallery'])){?><h1>Gallery page</h1><p>Gallery content</p><?php}else{?><h1>Home page</h1><p>Home Page content</p><?php}?>
thanks for that bro how about if i have 4 links?
Link to comment
Share on other sites

if you are planning to add more pages you might want to consider using link <a href="index.php?page=gallery">then use the value passed to include that specific pages content (gallery.php)<?php include($_GET['page'].'.php'); ?>you would just have the html code WITHIN the body tags, and NOT the html, head or body tags, as these are in the index.php page which you going to insert into.index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script><style type="text/css"></style></head><body><a href="index.php">Home</a> | <a href="index.php?page=gallery">Gallery</a> | <a href="index.php?page=another">Another Page</a><?phpif(isset($_GET['page'])){include($_GET['page'].'.php');}else{?><h1>Home page</h1><p>Home Page content</p><?php}?></body></html>

gallery.php

<h1>Gallery Page</h1><p>Eu fugiat nulla pariatur. Ullamco laboris nisi duis aute irure dolor ut labore et dolore magna aliqua. Sed do eiusmod tempor incididunt velit esse cillum dolore qui officia deserunt. Excepteur sint occaecat ullamco laboris nisi sunt in culpa. Ut aliquip ex ea commodo consequat.</p><p>Velit esse cillum dolore cupidatat non proident, consectetur adipisicing elit. Duis aute irure dolor sed do eiusmod tempor incididunt ut aliquip ex ea commodo consequat. Ut enim ad minim veniam, ut labore et dolore magna aliqua. Sed do eiusmod tempor incididunt duis aute irure dolor velit esse cillum dolore.</p><p>Lorem ipsum dolor sit amet, eu fugiat nulla pariatur. Mollit anim id est laborum. Ut labore et dolore magna aliqua. Ullamco laboris nisi sunt in culpa excepteur sint occaecat.</p><p>Quis nostrud exercitation velit esse cillum dolore qui officia deserunt. Lorem ipsum dolor sit amet, ut labore et dolore magna aliqua. Velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat ullamco laboris nisi ut enim ad minim veniam. Cupidatat non proident, quis nostrud exercitation sed do eiusmod tempor incididunt.</p><p>Excepteur sint occaecat qui officia deserunt consectetur adipisicing elit. Ut enim ad minim veniam, duis aute irure dolor ullamco laboris nisi. Ut labore et dolore magna aliqua.</p><p>Lorem ipsum dolor sit amet, mollit anim id est laborum. Quis nostrud exercitation excepteur sint occaecat eu fugiat nulla pariatur. In reprehenderit in voluptate consectetur adipisicing elit, qui officia deserunt. Duis aute irure dolor cupidatat non proident, lorem ipsum dolor sit amet. Ut aliquip ex ea commodo consequat.</p><p>Ullamco laboris nisi sed do eiusmod tempor incididunt duis aute irure dolor. Consectetur adipisicing elit, ut enim ad minim veniam, cupidatat non proident. Ut labore et dolore magna aliqua. Duis aute irure dolor in reprehenderit in voluptate lorem ipsum dolor sit amet.</p>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...