Zend_Translate Navigation items from application.ini - zend-framework

At the moment I try to translate my web application with zend_translate.
I made it already that far to translate the view in the application.
At the moment I struggle with the follow thing. I want to translate my navigation items
who I setup by application.ini . I have no clue how to make this thing working.
I hope someone can show me an clear example with some description.
With kind regards,
Nick

don't you run through the navigation items in the view? like this
<?php
// in controller something like:
// pseudocode: $this->view->nav_items = My_Model_Nav::getItems();
// somewhere in the view:
?>
<ul>
<?php foreach ($this->nav_items as $item) : ?>
<li><?php echo $item['name']; ?></li>
<?php endforeach; ?>
</ul>
i think in this case, you only have to change one line into:
<li><?php echo $this->_($item['name']); ?></li>
if not, post your view snippet

Related

Magento 2: How to call logo in phtml file

I was trying to call logo in custom phtml file with following code.
<?php echo $this->getLayout()->createBlock("Magento\Theme\Block\Html")->setTemplate("Magento_Theme::html/header/logo.phtml")->toHtml(); ?>
We can call logo with following code..
<?php echo $this->getLayout()->createBlock("Magento\Theme\Block\Html\Header\Logo")->setTemplate("Magento_Theme::html/header/logo.phtml")->toHtml(); ?>

product added to wishlist from compare window added twice

I added a product to compare and from the compare window I added the product to wishlist, then same product got added twice.
I had this issue in the magento installation i was working in. Then I tried it on the default installation and had the same issue. Is this magento bug or am I doing something wrong?
I found out that the issue was due to this code segment in the file catalog/product/compare/list.phtml:
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<ul class="add-to-links">
<li><?php echo $this->__('Add to Wishlist') ?></li>
</ul>
<?php endif; ?>
The onclick="setPLocation(this.href, true)" is causing the product to be added to wishlist in the parent browser window while its being added to the current window as well resulting the product to be added twice in the wishlist.
I fixed this issue by changing the onclick value to
onclick="setPLocation('<?php echo Mage::getUrl('wishlist'); ?>', true)"
This solved the issue.

Zend view not loading information from controller

I have zend framework setup .. while my view is loaded it does not dynamically takes information fro the controller
View source from the page looks like :
<script type="text/javascript" src=" <?=$this->currentUrl?>scripts/jquery.timers.js"> </script>
<h1></h1>
you can see at run time values are not populated in view. While I dont see any errors and I have verified all paths :(
Please help
I'll start with, unless you made your own view helpers...
<?=$this->currentUrl?>scripts/jquery.timers.js">
should probably be in your layout or view as
<?php echo $this->headScript()->appendFile('scripts/jquery.timers.js') ?>
and
<h1></h1>
would look much better as
<h1>title=<?php echo SITE_NAME ?></h1>

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.

ZF view navigation helper: How to set several menu for one view?

I have two xml menu. I set it up this way:
<?php echo $this->Navigation($this->menuPrivate)->menu(); ?>
<hr />
<?php echo $this->Navigation($this->interfaceMenu)->menu(); ?>
<?php
echo '<pre><br/>';
var_dump($this->Navigation($this->interfaceMenu));
die();
?>
Within var_dump is correct data. But the menu rendering shows me the same result - $this->interfaceMenu the same as $this->menuPrivate.
So is it possible to setup different menu for one view?
Sorry, my fault. It should be look like:
<?php echo $this->Navigation()->menu($this->menuPrivate); ?>
<hr />
<?php echo $this->Navigation()->menu($this->interfaceMenu); ?>