how can I develop a multipage website?
should I develop all other linked pages in same way I created the homepage?
I am intending to develop a PHP website for a store and I wanna link each products to their individual pages. but since there are lots of products its kinda tedious to create individual pages each product.
SO Instead of creating many different pages for each product can I create one dynamically changing page and use it for all the product links?I mean can I create a single page whose basic layout will always remain the same but only few content will change in accordance to the selected product.
Yes, you can do that; its very common to create a page that dynamically changes.
For example, you can create a php file that takes care of the header portion of the site, then simply call it within your index.php page as so:
<? show_header(); ?>
Take a look at this website to get started!
http://www.techiwarehouse.com/engine/d3bf2317/Building-Dynamic-Web-Pages-with-PHP
The site i provided is great to start playing with PHP, it provides good information with easy to follow steps.
Another great resource is the IBM PHP PDF:
http://www.ibm.com/developerworks/linux/tutorials/l-php/l-php-pdf.pdf
Finally my personal favorite, "Practical PHP & MySQL" PDF:
http://utopia.duth.gr/~stavtran/vivlia/PHP_and_MySQL.pdf
Its also worth noting that there are Content Management Systems out there (CMS) such as Joomla, Worpress which are very easy and powerful, a lot of these CMS's allow for plugins which will make your life so much easier. If your goal is to simply have a solid working e-commerce website that sells products and you don't really wish to do hardcore php,mysql,javascript,css,html,jquery coding ;-)
Content Management Systems
http://wordpress.org/
http://www.joomla.org/
You can implement a single page, lets call it product.php. Then you can use theGET method to dynamically call the page. It would look like this product.php?id=1 where id=1 is the primary key of the product in a MySQL table. And you could fetch various products just changing the id in url.
You can create multipage PHP website using following method:
1) Create a folder and name it “my_first_php_website”.
2) Create following folders in your “my_first_php_website” folder.
“images”, “includes”
3) Create following folders in “includes” folder.
“css”, “js”
4) Create following files in “my_first_php_website” folder.
-> “index.php”, “header.php”, “footer.php”, “sidebar.php”, “nav.php”, “404.php”, “about.php”, “functions.php”
Create following file in “css” folder.
-> “style.css”
Put your website logo in “images” folder.
-> “my_website_logo.png”
5) Now follow step by step tutorial to create your first website using PHP.
Source: Web Designer Tricks
Related
Ive created a portfolio website for myself, there is a gallery which users can enter, click on a thumbnail and then go to a new html page with the full image and description. Now on this full image page i have a list of other fullimage pages for project 2,3,4,5, etc..
But obviously manually updating project2.html to have a list of all other projects minius project 2 in the sub nav is very tedious and mistakes will occus when i have to do it for all 12 plus pages. So im after the page people are viewing not to appear in that sub nav.
My problem is.. Do i scrap the custom html site and move onto a cms.. The logical step for this sort of dynamic nav. Or do i try and include php if possible. Can anyone suggest the best approach for this, im aware it might in the longrun be easier to run off a cms but i do like the control i get and knowledge i hand crafted my html.
Thanks
Mat
If you wanted to do this with php, you could do so by making a single file containing the navigation, for example nav.html:
Project 1
Project 2
Project 3
all the project pages would then need to be php files, with the appropriate .php extension, and in each of them you would have:
<p>All your normal page html about the project and such that's above your navigation</p>
<?php
include("nav.html");
?>
<p>Anything underneath your navigation</p>
Alternatively, the CMS is a viable choice, or if you particularly fancied learning some php, you could actually code a perfectly servicable system to do this without too much trouble yourself.
If your don't want to use CMS , you can create a php file to handle requests for example , a php file that receive this request :
http://myfolio.com/moreinfo.php?album_id=1&
now in the php file you can get informatin from DB and folders then create a HTML Stream and then output it.
I am a beginner at using mysql/phpmyadmin, and have never used a cms before. I'm trying to get my head around how I could possibly add a 'similar posts' type script - but instead of showing posts, I would like to show some similar images (similar projects) when viewing each project page of my website.
My website setup is fairly simple:
main html page
profile html page
portfolio php page -> has thumbnail images with links to php generated url project pages
project page -> a dynamic php page that generates pages from pagination
contact html page.
The project php page has a jquery slideshow, project title and project overview text. The page uses three sql database tables for the data (slideshow images/text, page id for the pagination and one for normalisation), and uses pagination to change the data, creating a page for each project.
I'd really appreciate any ideas/opinions on how I could go about doing this - with sql, or am better off using a CMS (if so, do you know of a really simple one that could suit my website setup?).
If you're mainly wondering how you determine similarity, then you can do that with a text search in MySQL. I also found this page if you want to go to the trouble of building a tagging database schema. The former is simpler, but the latter is a really useful if you want to practice joins.
So I've built my site in Code Igniter and there are a number of pages where I feel it'd be easiest if the client could edit the content inline - much like what MojoMotor offers.
I'm not interested in using mojomotor but I wondered if anyone had done anything like this for their code igniter project?
As an idea of how it could work:
I was thinking that the client admin user could login to the normal custom built admin CMS area. After logged in, with session set, they can browse out to the public site for selected pages.
These pages will have a check for that admin session built in and if it's present, it can include a js file, which will overlay an admin banner and somehow enable the fields (perhaps content divs with a certain id or class relating to the corresponding table/field in DB) for editing.
--EDIT--
I've seen quite a few js inline editors around. I guess my confusion is over how best to integrate them with my database and controllers - i.e. idea of having the div id/class somehow map to the db field.
The bottom line is that MojoMotor is a CodeIgniter app and not a library. Therefore trying to work the code into your existing CodeIgniter project is not really an option.
But if you're willing, you can integrate your CodeIgniter project into MojoMotor and have the benefits of both. Here is a series of articles written on how to do this.
This is one example of the code you are looking for . You'll have to adapt the method for use with CI
I have a website live cricket scores , in which dynamically i am controlling the news section.
I have my own custom build CMS system with PHP, where admin will add the news to the web portal.
If i generate the Sitemap, all dynamically created pages wont be added to the sitemap,
is this a good practice or do we need to add the dynamically created links in sitemap?
if yes, can you please share how we can add dynamic links?
One more observation, I have made, whatever the news which is added getting cached within 4 Hrs in google.
Please share your thoughts, thanks in advance
If the pages are important, then you should add them to the site map so they can be indexed for future reference. However, if the pages are going to disappear after the match, then I wouldn't put them on the site map as they may get indexed then disappear, which may have a negative impact on your search engine rankings.
You can add these dynamic pages to a site map in a couple of ways:
Whenever a new dynamic page is created, re-create your site map. Do this by looking through the database for the pages which will be valid and writing them out into an XML site map file.
When a new page is created, read the current XML site map, and insert a new entry into the relevant place.
I would say the easiest option is option 1 as you can quickly and easily build a site map without having to read what you already have. That option also means that when you remove a one of the dynamic pages, it will be removed from the site map when it is re-built without the need to read through what you have, find the entry and remove it.
Google code has a number of different options for you, some of which you can download and run, others look like they need implementing within your own code.
Yes, if these pages content needs to be referenced by search engines, of course they have to be in sitemap.
I worked on a lot of ebusiness website and of course, almost 99% of pages where dynamically generated, almost 1000 product pages versus the 3 sales conditions & legal static pages.
So the sitemap itself was dynamic and regenerated every 15 minutes (to avoid dumping the whole product base each and running thousands of queries each tim the sitemap is called).
You can use a sort of separate script to do this : I would do one static part template if you have static page, and one other embedding the dynamically generated urls.
It would be easier if you CMS already embed url management (or routing) system.
How is it possibe to generate a list of all the pages of a given website programmatically using PHP?
What I'm basically trying to achieve is to generate something like an sitemap, in nested unordered list with links for all the pages contained in a website.
If all pages are linked to one another, then you can use a crawler or spider to do this.
If there are pages that are not all linked you will need to come up with another method.
You can try this:
Add an "image bug/web beacon/web
bug" to each page you tracked as
follows:
OR
alternatively add a javascript function to each page that makes a call to /scripts/logger.php You can use any of the javascript libraries that make this super simple like Jquery, Mootools, or YUI.
Create the logger.php script, have it save the request's originating URL somewhere like a file or a database.
Pros:
- Fairly simple
Cons:
Requires edits to each page
Pages that aren't visited don't get
logged
Some other techniques that don't really fit your need to do it programatically but may be worth considering include:
Create a spider or crawler
Use a ripper such as CURL, or
Teleport Plus.
Using Google Analytics (similar to
the image bug technique)
Use a log analyzer like Webstats or a
freeware UNIX webstats analyzer
You can easly list the files with the glob function... But if the pages uses includes/requires and other stuff to mix multiple files into "one page" you'll need to import the Google "site:mysite.com" search results.. Or just create a table with the URL of every page :P
Maybe this can help:
http://www.xml-sitemaps.com/ (SiteMap Generator)