![]() |
PHP Assistance... How Do I Do This Please?
Lets say i have an index.php file and 2 lists of words for example;
List One: Red Blue Green Yellow List Two: Cats Dogs Birds Fish How would i go about dynamically changing the content to automagically insert combinations of both lists in specific areas of the index.php page so it changes like below: This page is about selling Red Fish This page is about selling Blue Fish This page is about selling Green Fish This page is about selling Yellow Fish Or; This page is about selling Red Dogs This page is about selling Blue Dogs This page is about selling Green Dogs This page is about selling Yellow Dogs Using all combinations of words in list 1 as the primary word and list 2 as the secondary word? Would it be something like this... Code:
<?php domain.com/?list1&list2 Does that make sense to any of you who are technically inclined? Basically, i want to generate a list of URL to throw in a site map and have the page dynamically show whatever 'phrase' based on list1 and list2 the url contains. |
Quote:
Code:
<?php This page is about Red Dogs When you visited: yoursite.com/?color=Red&animal=Dogs Edit: Obviously you'd need to perform sanitization to protect against malicious requests. |
|
I normally do it as
$colors = array("Red","Blue","Green","Yellow"); $pets = array("Cat","Dog","Bird","Fish"); $color = $colors[array_rand($colors)]; $pet = $pets[array_rand($pets)]; print "The Color of the " . $pet . " is " . $color . "!"; |
I think you guys missed the "Using all combinations" part
Code:
// URL http://www.domain.com/?colors[]=Red&colors[]=Blue&colors[]=Green&colors[]=Yellow&animals[]=Fish&animals[]=Dogs |
Okay, LIMIT 1. But something's still not quite right...
http://dvdmedia.ign.com/dvd/image/gremlins2_03.jpg (I hope the OP appreciates the effort being put in here.) |
Quote:
Id still need a list of combinations ?color=Red&Animal=Dogs though to include in the sitemap.xml file though. As far as the sanitization goes, do you know if its possible to have 'exclusion words' in the code you posted above or would that be something different? Thanks everyone for their assistance (and the funny pics :thumbsup) |
Quote:
|
Quote:
$gremlin_parts=explode(" ",$gremlin); |
Quote:
|
<? echo "hello world"; ?>
|
All times are GMT -7. The time now is 02:25 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123