wait Posted November 15, 2012 Share Posted November 15, 2012 I'm sure this is fairly simple... Let’s say I have hundreds of pages, each require a short description per page. I also have one individual file with every short description on it. All the descriptions within this one file are each separated by DIVs that carry a unique ID. I would like to reference that unique ID on the “hundreds of pages” rather than copy and paste content on each page. So, one includes file is referenced per page calling the unique ID a specific DIV. Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/270712-how-do-i-render-only-select-divs-from-one-included-file-with-a-unique-id-on-multiple-pages/ Share on other sites More sharing options...
Mahngiel Posted November 15, 2012 Share Posted November 15, 2012 I suppose you could treat it like a flat file DB and do searches for the data. Quote Link to comment https://forums.phpfreaks.com/topic/270712-how-do-i-render-only-select-divs-from-one-included-file-with-a-unique-id-on-multiple-pages/#findComment-1392528 Share on other sites More sharing options...
wait Posted November 15, 2012 Author Share Posted November 15, 2012 (edited) Forgive my ignorance but I was hoping for a code example. Could I do a simple if, else... statement? If ID of Page = X then display DIV containing ID equaling X. Edited November 15, 2012 by wait Quote Link to comment https://forums.phpfreaks.com/topic/270712-how-do-i-render-only-select-divs-from-one-included-file-with-a-unique-id-on-multiple-pages/#findComment-1392530 Share on other sites More sharing options...
Zane Posted November 15, 2012 Share Posted November 15, 2012 Read up on how to use DOMDocument http://php.net/manual/en/class.domdocument.php inside that class is a function called, getElementById http://www.php.net/manual/en/domdocument.getelementbyid.php Quote Link to comment https://forums.phpfreaks.com/topic/270712-how-do-i-render-only-select-divs-from-one-included-file-with-a-unique-id-on-multiple-pages/#findComment-1392534 Share on other sites More sharing options...
wait Posted November 21, 2012 Author Share Posted November 21, 2012 Thanks for the direction. Got it! Quote Link to comment https://forums.phpfreaks.com/topic/270712-how-do-i-render-only-select-divs-from-one-included-file-with-a-unique-id-on-multiple-pages/#findComment-1393964 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.