How to Get the View Template Content as a String in Variable

How to Get the View Template Content as a String in Variable?

This is For Cakephp, It Loads the Template Content as a string in a variable.

$view = new View($this, false);
$view->set(compact('parameter1', $parameter1));
$view->set(compact('parameter2', $parameter2));
$html = $view->render('view_page_name');

How to Print Last Executed Query in CakePhp?

How to Print Last Executed Query in CakePhp?

 

Here, ModelName is the Query from Model Name

$dbo = $this->ModelName->getDatasource();
$logs = $dbo->getLog();
$log = end($logs['log']);


echo "<pre>"; print_r($log); echo "</pre>"; 
exit();

 

# The Output will come like this….

 

Array
(
    [query] => SELECT * FROM .......
    [params] => Array
                (
                )

    [affected] => 0
    [numRows] => 0
    [took] => 3
)

 

Meta Tags for Search Engine Optimization

Meta Tags for Search Engine Optimization
# Meta Tags used for seo::
<meta name="description" content="Stackofcodes is a blog for Learners, Developers, designers. "/>

<meta name="robots" content="noimageindex,noarchive,nosnippet"/>

<link rel="canonical" href="//www.stackofcodes.in/" />




<meta property="og:locale" content="en_US" />

<meta property="og:type" content="article" />

<meta property="og:title" content="Pricing | Kissmetrics" />

<meta property="og:description" content="Get, keep and grow more customers with Kissmetrics Customer Engagement Automation platform. Built for eCommerce marketers and product teams." />




<meta property="og:url" content="https://www.stackofcodes.in/" />

<meta property="og:site_name" content="Kissmetrics" />

<meta property="og:image" content="" />

<meta property="og:image:secure_url" content="" />

<meta property="og:image" content="" />

<meta property="og:image:secure_url" content="" />




<meta name="twitter:card" content="summary" />

<meta name="twitter:description" content="Stackofcodes is a blog for Learners, Developers, designers." />

<meta name="twitter:title" content="Stackofcodes" />

<meta name="twitter:image" content="" />


CakePhp – find condition for a query between two dates

How to  find condition for a query between two dates in Cakephp?

 

# Example-1:

$conditions = array(
    'conditions' => array(
       'and' => array(
            array('Item.date_start <= ' => $date,
                  'Item.date_end >= ' => $date
            ),
       'Item.title LIKE' => "%$title%",
       'Item.status_id =' => '1'
    )
  ) 
);