imperium2335 Posted April 7, 2009 Share Posted April 7, 2009 Hi, Is it possible and reasonably easy to make a script that will produce loads of pages based on a template page, and for each page add in 2 images? Those pages would also have title and keyword tags randomly generated from a pool of words to (similar to what i was making before). I've learnt quite a lot so far so I want to take on this. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/152924-solved-creating-pages-based-on-a-template/ Share on other sites More sharing options...
laffin Posted April 7, 2009 Share Posted April 7, 2009 Yes, sounds like a fun project. Good luck on it. Quote Link to comment https://forums.phpfreaks.com/topic/152924-solved-creating-pages-based-on-a-template/#findComment-803841 Share on other sites More sharing options...
blueman378 Posted April 7, 2009 Share Posted April 7, 2009 Hi there, ITs a pretty simply idea. In your template have regoins specified, eg <DOCTYPE blablabla... > <head> <meta description="keywords" content="[keywords here]" > <title>[Title here]</title> ... </head> <body> <div class="header">[Title Here]</div> <div class="textleft">[user text here]</div> <div class="image1right"><img src="[image1source]"></div> <div class="image2right"><img src="[image2source]"></div> <div class="footer">© [title here] 2009 </div> </div> </html> you would then read the file use regex to replace the values then save the file Too a different name! Quote Link to comment https://forums.phpfreaks.com/topic/152924-solved-creating-pages-based-on-a-template/#findComment-803872 Share on other sites More sharing options...
imperium2335 Posted April 8, 2009 Author Share Posted April 8, 2009 Yea I know how to make the template, but like I want it to inject things into the template from ss includes that randomly generate the titles etc from pools of words, then to create the page in a seperate directory, then back to the template, mix it up again, pump out another page if you get what i mean. Quote Link to comment https://forums.phpfreaks.com/topic/152924-solved-creating-pages-based-on-a-template/#findComment-804144 Share on other sites More sharing options...
blueman378 Posted April 12, 2009 Share Posted April 12, 2009 well how are your "random pool of words" stored? Quote Link to comment https://forums.phpfreaks.com/topic/152924-solved-creating-pages-based-on-a-template/#findComment-807688 Share on other sites More sharing options...
imperium2335 Posted April 12, 2009 Author Share Posted April 12, 2009 Hi. In an array. Quote Link to comment https://forums.phpfreaks.com/topic/152924-solved-creating-pages-based-on-a-template/#findComment-807689 Share on other sites More sharing options...
blueman378 Posted April 27, 2009 Share Posted April 27, 2009 well then, check the array length, then use the rand function to generate a random number between 0 and arraylength, then replace that word into the file by way of its index, ,do this for each word you want replaced. Quote Link to comment https://forums.phpfreaks.com/topic/152924-solved-creating-pages-based-on-a-template/#findComment-820192 Share on other sites More sharing options...
imperium2335 Posted April 27, 2009 Author Share Posted April 27, 2009 Thanks for all your help. I've finished my project (about 500 lines) and it works perfectly for what I wanted. I've learnt alot so you probably wont hear from me for atleast a month Quote Link to comment https://forums.phpfreaks.com/topic/152924-solved-creating-pages-based-on-a-template/#findComment-820214 Share on other sites More sharing options...
blueman378 Posted April 27, 2009 Share Posted April 27, 2009 good to hear. Quote Link to comment https://forums.phpfreaks.com/topic/152924-solved-creating-pages-based-on-a-template/#findComment-820221 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.