yii layout no visible changes - php

I tried force refresh on my browser and change the name of the layout from main.php to main_.php still nothing happened. No visible effect, no error, no nothing.
I'm sure missing a small detail here. Can anyone guide a beginner in this problem?
Version: Yii 1.1.10

check the main layout in site/layouts and in themes/layouts too, definitely there are more version of it.
For you the yii debug toolbar 3rd party extension would definitely help to identify the layout file that is used, install it.
You can control which layout files is included with the controller's $layout property
You need to tell your controller to use layouts from the current module, with single slash notation eg : $layout = '/site/myview' read more about this at: getLayoutFile()

Related

Why does Yii render "<?php" into every backend controller output?

Reproduceable problem
In 2.0.3 "advanced" (Yii offers basic and advanced setup of a project) create an empty controller in the backend, like
public function actionTest()
{
}
and call it in the browser. You'll see an empty page. When looking at the source code, you'll see a lonely php tag.
<?php
This looks like a bug to me, as it does not happen in the frontend folder, just in backend folder. This is critical when you render out CSV files or so, it will break the file.
I'm unsure if this is a bug on my side or a real bug inside the framework.
This is a bug in Yii 2.0.3!
... caused by a lower-level and not-so-obvious whitespace problem in naked PHP files.
Tickets & more information:
https://github.com/githubjeka/yii2-rest/issues/3
https://github.com/yiisoft/yii2-app-advanced/issues/24
http://php.net/manual/en/language.basic-syntax.phptags.php#116883
How to fix this:
The problem in a nutshell: A PHP tag is <?php[whitespace character], not just <?php. Holy! Totally makes sense, but let's be honest, who would have known this instantly ?
Yii 2.x uses (in the advanced demo application) the "empty" file config/bootstrap.php, just containing a php tag <?php WITHOUT a whitespace directly after. When bootstrap.php is now loaded via index.php it is loaded as a text file containing <?php, not parsed as a PHP file.
You can fix this by simply added a whitespace directly after the tag.

How to find out which view file is loaded in Joomla 3.2?

I'am templating the website under the Joomla 3.2.0 for HikaShop ecommerce component, and would like to find out which file is loaded with following code, so I could correctly override the styles for specific file.
The filename I'a working with is root\templates\MY_TEMPLATE\html\com_hikashop\user\registration.php. Inside that file there is a small part of code which underloads custom fields I would like to override with custom styles:
<div class="address-fields">
<?php
$this->type = 'address';
echo $this->loadTemplate();
?>
</div>
Anyone knows which filepath is exactly loaded with the following $this->loadTemplate(); ?
Not sure if you are using it the same way as it is used here, but they explain it as if the parameters you pass in the function loadTemplate(), actually as loadTemplate(address) would be files in your case found in registration_address.php
hey, It's worth a shot checking it out
SEE HERE

Zend Layout - Header and Footers

I feel my problem is relatively simple. I'm new to the Zend framework and I'd like to be able to call a controller to do some work for a header or a footer. I've already created a HeaderController and a applications/views/scripts/headers/index.phtml - all I'm trying to do is get that data, and put it in my layout by default.
Everything works if I navigate to /header, by the by.
Edit:
Made some progress - if I add:
$this->render("header/index.phtml");
it renders all the static data, but doesn't seem to be running the HeaderController.
Try this bit of code out, be sure to disable the layout in your header controller, as the purpose is only to render a limited amount of content.
<?= $this->action('index', 'header', null, array('possible_args'=>'here')); ?>
The documentation can be seen here.
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.action

Symfony output only template--without adding to layout.php

Is there any way to disable the addition of layout.php to my actionNameSuccess.php? I would like this setting to be enabled for some modules and disabled(i.e. let layout.php add up) for other modules.
I can solve the problem by making a new application and setting its layout.php to just
<?php echo $sf_content?>
but I would like a same-application solution. Since I need to have links between these two and link_to only works relative to an application and I don't want to pass an absolute url.
You can call $this->setLayout(false); in your action. I think you may also achieve this with the view.yml file.
UPDATE: as denys281 pointed out, the way to do this in view.yml is to use
has_layout: false

How to pass Yii session to scripts out of Yii framework?

I have a self-made math captcha and it should be output without anything before it's image header, so I can't make it a 'View'. I put this captcha.php in the web root dir, but it can't share session with scripts in Yii. How to solve this?
Is there any way to pass the session from Yii to the other scripts or clean anything before the header in view?
Though it is true that the default layout wraps the page's content with the typical html markup you'd expect, you have complete control over that by specifying the layout you'd like from the controller by using $this->layout = ... You can set it to null to use module layout or false to disable the layout completely. See more details in Yii API Docs.
Alternatively you can call $this->renderPartial('view name') if you'd like the output of your captcha script displayed without the surrounding page content.

Categories