Dynamic Content in CI |
[eluser]seismic[/eluser]
I'll anlayze your suggestions. Thank you guys. Cheers.
[eluser]DJMOHNL[/eluser]
Hey. i thought i might give you some suggestion with making dynamic php views. Code: <?php So now we have created a controller with a specific article id to show. We can go on and make the view file and generat the content thats needed for your users. So lets show the view file. Code: <?php So thats how i normally do it, its a professional way. Not completely explained, just show it shortly. It can be fast and professional with CI, if you just make sure it can be handled. You could try the 'try, catch, break' functionality of php inside CI to make it better to overlook it. I hope you could use this, i prefer the way you use header, menu, controllerview and footer pages seperate. It just makes life easier! :coolsmile:
[eluser]Phil Sturgeon[/eluser]
If you hard-code it why not use slugs? And why not do this in a DB? Seems a VERY rudimentary way to handle news articles.
[eluser]DJMOHNL[/eluser]
Its just for showing purposes, if you read well youll notice all the info. You can use this way to edit your CI scripts with usage of models, views, controllers (MVC)! Just place the model ($this->load->model('mymodel')) in the top of the controller function name Test. then use your model code, loading your content on your view page. might be usefull for pages with multiple diffrent content. Just look at it carfully, you should be able to make your way the easiest way to use your MVC CodeIgniter efficiently. good luck.
[eluser]Unknown[/eluser]
[quote author="stuffradio" date="1260407765"]KISS (Keep it simple stupid) Models -> Handles all database transactions Views -> All the stuff that gets outputted to your brwoser Controllers -> Controls what happens, logic can happen in here too. You can store content for certain pages in a database. Say you have page A, in your browser path you can go http://mysite.com/index.php/page/index/A You take the value from the 3 segment, that's the value A. You go to the model and fetch the data for page A. You store the values of page A in variables and load them onto the view. Try playing around with that concept, I have to go to school now... I'm sure others can help if you have other questions while I am gone.[/quote] I really need a post-it with KISS in sharpie on my desk...
|
Welcome Guest, Not a member yet? Register Sign In |