Parse data?? |
[eluser]flyenig[/eluser]
ok this is in a row in a table in my database Code: <html> How do i parse this template that came from my database?? i tried the parser class but apparently you need to have this in a view file. Thanks for the help
[eluser]pickupman[/eluser]
You would use this: Code: //In Controller
[eluser]flyenig[/eluser]
Thanks for the reply. Yea i can do that, what im saying is how can i do that with out having to make a "your_view.php" file or something like that?
[eluser]pickupman[/eluser]
[quote author="flyenig" date="1273481106"]Thanks for the reply. Yea i can do that, what im saying is how can i do that with out having to make a "your_view.php" file or something like that?[/quote] That's kind of the whole point for MVC. You would have to have a view in order to parse it. Otherwise, you can just echo the code in your controller, no need for a view.
[eluser]danmontgomery[/eluser]
Just by opening the parser library, you can see that $data is passed to both the view and the template parser: Code: function parse($template, $data, $return = FALSE) So, you should be able to just have a catch-all view, pass the template to a variable in that view then the template will be parsed, all using the same array. Controller: Code: $post = $page->row(0); //Save result to object View: Code: <?php echo $page_template;?>
[eluser]flyenig[/eluser]
Ok let me just post everything to make this more clear. This is going to be a confirm email template so im trying to make this work. This is the template that is fetched from the database Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> This is in the model Code: function email($data)
[eluser]pickupman[/eluser]
Putting it all together Code: //In your controller TIP: You may to switch from using base_url().'main/verify' to site_url('main/verify') as it will automatically add/remove index.php from your links. You will probably want to replace using < ? echo with {} tags in your template, as you are parsing them, and not evaluating.
[eluser]flyenig[/eluser]
Thank you very much pickupman and everyone who helped me! |
Welcome Guest, Not a member yet? Register Sign In |