Remove the mysql output from the Cakephp 2.5 default layout - cakephp-2.5

Is there anyway to remove the mysql output from the cakephp default layout without the need to change the complete default layout?

At the bottom of default.ctp there is a line
<?php echo $this->element('sql_dump'); ?>
change it to
<?php //echo $this->element('sql_dump'); ?>

Related

Opencart Currency Symbol

What is the problem ?
Euro symbol does not appear.
This may be the reason
Currency have two symbols symbol right and symbol left. To make support for both types of currency you need to include both symbols.
You forgot to include following code.
<?php echo $currency['symbol_right'] ?>
Your full code looks:
<?php echo $currency['symbol_left']; ?> <?php echo $currency['title']; ?> <?php echo $currency['symbol_left']; ?>

How do i use translate in the form using Zend?

<?php echo $this->translate("Hello World"); ?>
This works inside view. How do I get the same in the form?
In a Form, you can try this :
$this->getView()->translate("Hello World");

symfony 1.4 FORMS - how to replace default (related) dropdown field by code generated in module / component?

I've been creating with a ajax and doctrine chain-dropdown to select a category. I put them in component. It works like this:
http://www.plus2net.com/php_tutorial/ajax_drop_down_list.php
Im trying to replace default category dropdown build on schema and related with current table. When in
/lib/form/doctrine/TabbleForm.class.php
I remove a field with code:
unset($this['category']);
And in the tamplate which has a form body I paste a component code (with this dynamic ajax-based dropdown):
include_component('add', 'selectcategory',array('catid' => 0));
I have notice:
Unexpected extra form field named "category".
How can I replace that default code with category-field code from component / module?
How do you display your form in the template? Using a basic <?php echo $form; ?> or manually like:
<?php echo $form['field']->renderLabel() ?>
<?php echo $form['field']->render() ?>
<?php echo $form['field']->renderError() ?>
I suggest you to use the second method, at least using <?php echo $form['field']->renderRow() ?>. This way, you won't have to unset the categoy field from your Form class. But you will have to name the select tag in your component the same way the form do.
If the form display:
<select id="formname_category" name="formname[category]">...</select>
You will have to use the same name (for the second select I guess). Then, you won't have any problem in your form and, more important, the validator related to your category field will also work!

Format date in the indexSuccess.php

I want to format the created_at field date from the original for something like 03.May.2011 to be shown in the indexSuccess.php and in the showSuccess.php
Could you help me?
thanks
You can make in symfony in your indexSuccess.php and showSuccess.php instead of for example:
<?php $value->getCreatedAt() ?>
next:
<?php echo date('d.M.Y', strtotime($value->getCreatedAt())) ?>
You can use other formats.
The format of some data absolutely not belongs into controller context - so please use
use_helper("date");
echo format_date($myDate);
from symfony's date helper in your template (showSuccess.php, blaSuccess.php) or partial (form.php, list.php, test.php) !
You'll find more informations here http://www.symfony-project.org/gentle-introduction/1_4/en/13-I18n-and-L10n#chapter_13_sub_outputting_data_in_the_user_s_culture or in the source file.
I believe the date is returned in a string format Y-m-d H:i:s, as fits the MySQL datetime type. It would be nicest to convert this to a PHP DateTime instance using DateTime::createFromFormat, presuming you are using PHP > 5.3.
So, in your controller:
$this->creation_date = DateTime::createFromFormat('Y-m-d H:i:s', $item->created_at);
Then, in your view:
<?php echo $creation_date->format('d.F.Y') ?>
See also DateTime::format
If you are using PHP 5.2 or before, you can't use createFromFormat. You probably want to fall back on strtotime:
$this->creation_date = strtotime($this->created_at);
and in the view:
<?php echo date('d.F.Y', $creation_date) ?>
To create a datestring like your example (03.May.2011) use this way:
<?php use_helper("date"); ?>
<?php echo format_date($myDate,'dd. MMM. yyyy'); ?>

Zend Framework: headTitle()->append() issue

Has anyone run into this problem...
In my layout.phtml I have:
<head>
<?= $this->headTitle('Control Application - ') ?>
</head>
then in index.phtml I have:
<? $this->headTitle()->append('Client List'); ?>
I expect that, when I go to my index action, the title should be 'Control Application - Client List' but instead I have 'Client ListControl Application - '
What is going on? How can I fix this?
Default behaviour of the headTitle() is to append to the stack. Before calling headTitle() in layout.phtml, your stack is:
Clientlist
Then, you call headTitle with the first argument and no second argument (which makes it default to APPEND), resulting in the following stack:
ClientListControl Application -
The solution, in layout.phtml:
<?php
$this->headTitle()->prepend('Control Application -');
echo $this->headTitle();
?>
Additionally, you can use the setPrefix method in your layout as such:
<head>
<?= $this->headTitle()->setPrefix('Control Application') ?>
</head>
And in your controllers/actions/etc use the standard append/prepend:
<?php
$this->headTitle()->setSeparator(' - ');
$this->headTitle()->append('Client List');
?>
I don't actually use headTitle, but do use ZF, and I had a quick look on the mailing list, this might solve the problem:
<head>
<?= $this->headTitle('Control Application') ?>
</head>
Then:
<?php
$this->headTitle()->setSeparator(' - ');
$this->headTitle()->prepend('Client List');
?>
This happens because the layout is the last script to be executed. So you actually do the append BEFORE the set of the title, so that there's nothing to append to yet.
Set the main title (Control Application) in a Controller. For example I always do it in the predispatch action of a initPlugin so that it is execute before any other Controller Action, and I can append or prepend at will.
To use such a plugin just define a new Class extending Zend_Controller_Plugin_Abstract and define a function preDispatch(Zend_Controller_Request_Abstract $request) where you can put all your common-to-the-whole-site code, and to register the plugin just put it into the controllerFront of your bootstrap: $controller->registerPlugin(new InitPlugin());