Welcome Guest, Not a member yet? Register   Sign In
Working with templates
#1

[eluser]Ryan Zec[/eluser]
I know i can simulate a php foreach with {items}{/items} but it there a way i can simulate an if statement with a template file?
#2

[eluser]wiredesignz[/eluser]
Just use straight PHP for conditionals in your template files
#3

[eluser]Ryan Zec[/eluser]
I can using php code in files that also use the template system?
#4

[eluser]wiredesignz[/eluser]
Yes, the parser uses $this->load->view() first.

Code:
/**
     *  Parse a template
     *
     * Parses pseudo-variables contained in the specified template,
     * replacing them with the data in the second param
     *
     * @access    public
     * @param    string
     * @param    array
     * @param    bool
     * @return    string
     */
    function parse($template, $data, $return = FALSE)
    {
        $CI =& get_instance();
        $template = $CI->load->view($template, $data, TRUE);

...




Theme © iAndrew 2016 - Forum software by © MyBB