Magento include phtml file within another phtml file - tags

I am making a custom home page for my magento website in a phtml file named home_banner.phtml, which in turn i have referenced in the CMS->Pages->Home Page content by the following code
{{block type="core/template" template="theme/home_banner.phtml"}}
In my home_banner.phtml I have called tags/popular.phtml to display the popular tags.
<div class="last-posts-grid clearfix">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('tag/popular.phtml')->toHtml(); ?>
</div>
However the tags are not being displayed even though the anchor tag which says "view all tags" id getting called correctly. The ul class="tags-list" is also visible in the page source but the tags themselves are not visible. Any suggestions?

You made a small mistake in the template file. Your template file has to be as below:
<div class="last-posts-grid clearfix">
<?php echo $this->getLayout()->createBlock('tag/popular')->setTemplate('tag/popular.phtml')->toHtml(); ?>
</div>
I tested this and its working fine.. Hope this helps..

Related

Magento2 custom page templates

I have developed a custom Magento2 theme and created a Generic Page layout at Vendor/Theme/Magento_Theme/layout/default.xml. In that layout i have configured my custom generic layout to use Header - Content - Footer. I have set the menu positions and the appropriate blocks.
I am now looking for some static pages to use a template and within Content Area (of the Generic page layout). For example Home page must have a banner slider and Contact page must have a Google map. Is there any way to configure it to my theme?? Is that the page_layout section of my theme??? I cannot find any customization there.
Did you look at default Core file? For example
vendor/magento/module-theme/view/frontend/layout/default.xml ?
vendor/magento/module-theme/view/frontend/templates/html/footer.phtml
<div class="footer-container">
<div class="footer">
<?php echo $block->getChildHtml() ?>
<p class="bugs"><?php /* #escapeNotVerified */ echo __('Help Us Keep Magento Healthy') ?> - <a
href="http://www.magentocommerce.com/bug-tracking"
target="_blank"><strong><?php /* #escapeNotVerified */ echo __('Report All Bugs') ?></strong></a>
</p>
<address><?php /* #escapeNotVerified */ echo $block->getCopyright() ?></address>
</div>

How to use Assets in Moduls in fuelphp

I created one view called myview.php in my modul(Named adminpanel)
path(adminpanel\views\myview.php) in that I use following code but Assets are not load
<?php
use Fuel\Core\Asset;
use Fuel\Core\Session;
?>
<html>
<head><title>Admin Panel</title>
<?php Asset::js(array('jquery.js','test.js'));?>
</head>
<body>
<?php echo Session::get('my');?>
<input type="button" value="Call Designer Controller" >
</body>
here test.js and jquery.js are not work properly and I donot get any error in my browser
Asset::js() returns the HTML required to load the assets as a string.
If you don't ECHO it, nothing will happen.

Form tag is stripped off in Cake Php

Form tag is stripped off in Cake Php view file.
In 'login.ctp' (Layout view)
<div id="test">
<?php echo $this->Form->create(); ?>
Test form Elements
<?php echo $this->Form->end(); ?>
</div>
When checked in firebug console only creating below tags
<div id="test">
<div style="display:none;"><input type="hidden" value="POST" name="_method"></div>
Test form Elements
</div>
// "<div style="display:none;"><input type="hidden" value="POST" name="_method"></div>". This div tag is automatically created.
I also created a 'inner.ctp' on elements in views and tried to call from layout view(login.ctp) as echo $this->element('inner') , but results in same problem
Can any one help?
I'm almost certain that you have another form on your page, probably in your layout, that you're not closing with...
echo $this->Form->end();
If this is not the case, I suggest getting the latest stable version of Cake 1.3 and overwriting your current one.

Zend Framework: Is there a View Helper to display View Name in Layout Class?

As the title suggests, I'm trying to find a way of displaying the title of the View currently being displayed as part of the layout. I'm trying to do this so that the page title is dynamicly populated when a different view is selected.
In psuedocode:
<div>
<div id="header"><h1>My website</h1></div>
<div id="main">
<?php echo "<h2>" . SOME WAY OF ECHOING THE VIEW NAME HERE . "</h2>"; ?>
<?php echo $this->layout()->content; ?>
</div>
<div id="footer"><p>2011 My website.com></p>
</div>
I've been through the Zend documentation and the closest thing I could find was the headlink. However, I was unable to get the value from this helper and shoehorn it into a variable so that I could display its text as a page header for the view.
Thanks.
You could pass the action name (or combine with the module if needed) to the layout within the controller.
$layout = $this->_helper->layout->getLayoutInstance();
$layout->viewName = $this->_getParam("action");
Kind of dirty, but it would work
I´m not quite sure if I understood you right, but there´s something called a placeholder in ZendFramework. Basically you define the placeholder and fill it afterwards with whatever you want.

adding a page to jqtouch

So I have something like this:
<html>
<body>
<div id="jqt">
<div id="page1">
...
</div>
....
<div id="generic">
Some generic page to use as a template
</div>
</div>
</body>
</html>
and I want to create a new page on after everything is loaded and the user does some action.
$('#generic').clone().attr('id', 'some_new_page').appendTo('#jqt');
What happens is the new page ends up showing up in front of everything and doesn't seem to have and jqtouch events or styles added.
How do initialize this page (or at least have jqtouch reinitialize the whole html file)?
I don't want it to show up at first, I just wanted loaded and ready in the background.
Have you tried to do a deep clone with data and events instead?
$('#generic').clone(true, true).attr('id', 'some_new_page').appendTo('#jqt');