Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-07-2012, 01:05 AM   PM User | #1
d'Anconia
Regular Coder

 
d'Anconia's Avatar
 
Join Date: Jan 2010
Location: Tempe, AZ
Posts: 143
Thanks: 15
Thanked 5 Times in 5 Posts
d'Anconia is an unknown quantity at this point
Written HTML or Variables (PHP)?

I am trying to set up a website that would have a database full of companies and related information (ie name, country, website, description, etc), with the related information submitted to a database and stored.

I think there are two major options that I have for the individual pages that will represent each company:

1.) When the entity is first submitted by a user, use file_put_contents() to create a new web page for that entity. Insert the current variables (at that time) into the code for that webpage. This way there will be a webpage that is readable by crawlers for SEO purposes... I want to make sure that the individual entity pages will show up on Google and other search engines.

The problem with this method is that it will be more difficult to have the user dynamically make a change to the entity's related info. It would still be possible but I would have to use PHP to let them re-submit the information and then replace the old information in the HTML with the new information (as well as updating those variables within the MySQL database).

2.) Have a template already set up and when a new entity is submitted by a user, only submit the variables to a MySQL database and when a user wants to view the page for that entity, insert the variables into the webpage for the entity.

The problem with this method is that I believe it may cause problems for rankings when it comes to Search Engine Optimization. Entity name, country, website, and description are just a few very *necessary* variables that I can think of and there will be plenty more BUT I have read that having more than 3 PHP variables causes your page ranking to go down. Plus how would a search engine crawl a dynamically-created webpage? Does it have access to the MySQL database variables or would it enter that page by continuing from a preceding href link?

Am I totally thinking about this the wrong way? How do very popular sites like Wikipedia, Amazon, and IMDb apparently have so many pages that can still be indexed by search engines? I notice that Wikipedia and IMDb tend not to have *file names* at at the end of the URL's for the individual pages (articles and movies / individuals), so what method do you believe they use? Would a comparable method even be reasonable for a smaller website looking to eventually scale up (god willing)?
__________________
Powerful ideas for all lovers of personal and political freedom:
Freedomain Radio
Free Talk Live
d'Anconia is online now   Reply With Quote
Old 05-07-2012, 02:17 AM   PM User | #2
jmj001
Regular Coder

 
Join Date: Jan 2012
Posts: 271
Thanks: 2
Thanked 65 Times in 65 Posts
jmj001 is an unknown quantity at this point
IMO creating the physical files for each user is the wrong way, the only way you should do this is by utilising a database to store the detail and generating pages dynamically.

For SEO purposes you need to make use of a .htaccess file and http rewrite rules

Wordpress does this very well, a typical WP htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Essentially you have a single index.php file that all requests are redirected to by the htaccess file and it handles the database requests and delivers data to the browser

Eg; www.mydomain.com/this-business/

The htaccess file will rewrite the traffic to the index.php page and include a get variable with the value 'this-business' you then get the data from the db for the slug 'this-business' and dynamically display the page

research how wordpress does it and you'll find the best way IMHO
jmj001 is offline   Reply With Quote
Old 05-07-2012, 04:24 PM   PM User | #3
d'Anconia
Regular Coder

 
d'Anconia's Avatar
 
Join Date: Jan 2010
Location: Tempe, AZ
Posts: 143
Thanks: 15
Thanked 5 Times in 5 Posts
d'Anconia is an unknown quantity at this point
Thank you, I will take a look into it. I'm not as familiar with HTAccess but I'll read up on it.
__________________
Powerful ideas for all lovers of personal and political freedom:
Freedomain Radio
Free Talk Live
d'Anconia is online now   Reply With Quote
Reply

Bookmarks

Tags
dynamic pages, file_put_contents, seo

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:57 PM.


Advertisement
Log in to turn off these ads.