Welcome Guest, Not a member yet? Register   Sign In
Problem with parser
#8

Nothing, no one seems to understand.

I define the variables to be used in the view with parser:
PHP Code:
$ConfigurationSite $this->MainModel->Configuration();
$SeoBooks $this->Books->bookSeo();

$data = [
 
   'seo_book_title' => '$SeoBooks->title',
 
   'site_name' => $ConfigurationSite->name,
 
   'seo_title' => $ConfigurationSite->title,
 
   'seo_description' => $ConfigurationSite->description,
 
   'site_logo' => $ConfigurationSite->logo,
 
   'site_url' => base_url(),
 
   'site_categories' => $siteCategories
];

$this->parser->parse('template/default/libreria_head'$data); 

Model:

PHP Code:
public function Configuration()
{
 
   $this->db->cache_on();
 
   $sql  $this->db
        
->select('*')
 
       ->from('configuration')
 
       ->get()
 
       ->row();
 
   $this->db->cache_off();

 
   return $sql;
}

public function 
bookSeo()
 
   {
 
       return
            $this
->db
                
->select('title')
 
               ->from('books_seo')
 
               ->where('id_book',0)
 
               ->get()
 
               ->row();
 
   }

#return this value: "Buy On {site_name}" 

View:

PHP Code:
<html>
 
   <head>
 
       <meta charset="utf-8">
 
       <meta name="viewport" content="width=device-width, initial-scale=1">
 
       <title>{seo_title}</title>
 
       <meta name="description" content="{seo_description}"/>
 
       <meta name="robots" content="noodp" />
 
       <link rel="canonical" href="{site_url}" />
 
       <meta property="og:locale" content="es_ES" />
 
       <meta property="og:type" content="website" />
 
       <meta property="og:title" content="{seo_title}" />
        <
meta name="og:description" content="{seo_description}" />
 
       <meta property="og:url" content="{site_url}" />
 
       <meta property="og:site_name" content="{site_name}" />
 
    


In my database I have this string: Buy on {site_name}, If {site_name} was already defined above in $data, because when I show {seo_book_title}. 
{Site_name} is shown like this, and not with the name that was defined?
Reply


Messages In This Thread
Problem with parser - by Decibel150 - 08-31-2018, 08:11 AM
RE: Problem with parser - by Pertti - 08-31-2018, 08:57 AM
RE: Problem with parser - by Decibel150 - 08-31-2018, 09:50 AM
RE: Problem with parser - by ciadmin - 08-31-2018, 10:51 AM
RE: Problem with parser - by Decibel150 - 08-31-2018, 12:53 PM
RE: Problem with parser - by ciadmin - 08-31-2018, 03:03 PM
RE: Problem with parser - by John_Betong - 08-31-2018, 08:42 PM
RE: Problem with parser - by Decibel150 - 09-01-2018, 07:09 AM
RE: Problem with parser - by ciadmin - 09-01-2018, 07:44 AM
RE: Problem with parser - by Decibel150 - 09-01-2018, 08:41 AM
RE: Problem with parser - by John_Betong - 09-01-2018, 11:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB