Welcome Guest, Not a member yet? Register   Sign In
Manual outputting...
#1

[eluser]Lovecannon[/eluser]
Well, I was hoping to load a template from a database that is basically the same thing as a view file, but manually output it, and load in the variables, how would I accomplish this? The reason is, Id like to make a dynamic template system, so a user could make their own template, itd be stored in a database, and loaded through CodeIgniter, and I would like to inject the variables into it, like the $this-load->view() second parameter. Thanks in advance.
#2

[eluser]Lovecannon[/eluser]
Come on, someones got to have an answer.
#3

[eluser]gtech[/eluser]
to template stuff I normally store a header field and a footer field in the database with HTML content.
I then read the header and footer out of the database and then pass it to the view..

<?=$header?>
.. web content goes here
<?=$footer?>



Another way you could do it is store the users html in the database the user can put !var! in their html. when you read it out of the database you can do a preg_replace on the data to replace the !var!'s with your variables. you can wither echo the result or pass it to a view.



umm how else, ahh allow the user to upload a view and store it on the server (could be dangerous)


probably several ways to do it.




Theme © iAndrew 2016 - Forum software by © MyBB