PHP - Moved: Dynamic Link Creation
This topic has been moved to mod_rewrite.
http://www.phpfreaks.com/forums/index.php?topic=321416.0 Similar TutorialsHi So I have successfully set up a website and database where a user can create a listing and view listings on a listing details page. The viewing can only be done, however, only from either from either running a search query from the search form or from clicking one of the listings from the listing table. The listings are not being indexed from the search engines from the direct page, instead from the listing table which is about 3,000 listings, not very user friendly to land on this page and have to go through the table or use the table filter. Here's what I am trying to accomplish: A web page that has a dynamic presence / URL like a Wordpress page: http://www.mysite.com/listing_title/ The title of the page has the listing information in it: This page is about a $listing_title $listing_item listing number $listing_number that is online! Each individual Listing / page is indexed on the search engines and has a direct link to it I am familiar with PHP and have created this site but I am far from an expert! Please give me a code example or link to one because if you just say "do this to this and that" you will totally loose me. Thank you so much for any help. Hi All,
I've been interested in writing a PHP pdo configuration file so that I can include connections in various files on my site. While I was looking up some possible solutions I stumbled across an interesting post on stack overflow http://stackoverflow...-pdo-connection
The first responder suggested the code below. However, I don't understand how to access the connection and make query calls. I'm confused by how it's possible to return a variable name as an object { return new $name( $this->connection ) }.
Also, If someone could explain what the author means by { $something = $factory->create('Something');}. Wouldn't the "Something" need to be a class? And how would that class get the db connection?
All the best,
Karma
$provider = function() { $instance = new PDO('mysql:......;charset=utf8', 'username', 'password'); $instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $instance->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); return $instance; }; class StructureFactory { protected $provider = null; protected $connection = null; public function __construct( callable $provider ) { $this->provider = $provider; } public function create( $name) { if ( $this->connection === null ) { $this->connection = call_user_func( $this->provider ); } return new $name( $this->connection ); } } $factory = new StructureFactory( $provider ); $something = $factory->create('Something'); $foobar = $factory->create('Foobar'); Im rebuilding my website and have decided to make the dynamic images for my main photography gallery be layed out using div tags and css. I can get the images to load in and layout correctly but for some reason the links on the images only works on the last loaded in image. I check the code on the page and all the links are there but only the last one is active. The code worked when it was all wrapped in table tags. Is this a PHP or css issue stopping all the links expect for the last to be active. This is the css code I am using. #maincontent{width:1000px;margin:0 auto;padding:0 20px} #maingallery{height:382px;position:relative;width:1000px;text-align:center;margin-top:15px} #maingallery #text{position:absolute;top:50px} .gallery_item {float:left; margin: 20px 0 0 0; width: 200px; height: 67; padding: 0 10px 0 10px} .gallery_item .p {padding: 10px; font-size:12px} .gallery_item a:hover, a:active { display : block; border : none; } Any help would be greatly appreciated. Not sure if there would be any thing conflicting the links being active in either php or css. Thanks Matt Hi guys.. 1st post here. I'm pretty new to php.. just a few weeks in. I've gotten pretty decent at making mysql connections and extracting data, but now I'm wanting to take one of my urls that I echo to my page and create a new page. Hoping someone can help... Here's the pictu MY MySQL Setup: I have 1 table called table1. It has 2 columns which a 'Title' & 'Description' My Index.php Page: I connect to mysql. I pull the 'Title' from MySQL and loop it to produce 100 rows of data that fill my index page, as expected. My Problem: I now want to be able to click one of those rows and dynamically create a new page (description.php) that includes the 'Title' & 'Description'. My Progress: I've managed to click a row and create a hyperlink to mysite.com/$title (where 'title' is pulling the 'title' from the mysql db) but I all I get is page not found. My Question: How do I tell description.php to pull the 'Title' and 'Description' and link to it from index.php? My Gratitude: Thanks in advance! This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333152.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=306771.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=351100.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=342341.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=333014.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=342456.0 Great conversation, wrong board. This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=357967.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357806.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357949.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=307486.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=352987.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=349729.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=344960.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=353620.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=307669.0 |