Zend Framework 2 Navigation - php

Why vew helper duplicates the menu displays, though I give him a different set of data. Twice menu 'navigation1' is displayed
<?php echo $this->navigation('navigation1')->menu() ?>
<?php echo $this->navigation('navigation2')->menu() ?>
But the following code, individually, displays a different menu
<?php //echo $this->navigation('navigation1')->menu() ?>
<?php echo $this->navigation('navigation2')->menu() ?>
and
<?php echo $this->navigation('navigation1')->menu() ?>
<?php //echo $this->navigation('navigation2')->menu() ?>
Why is this happening and how can I avoid this? Thanks.

Can you post the factories and config arrays you are using to assemble the navigation? What you are showing should work fine so the issue lies in one of the other files but I would have to see them to help you.

Related

How to adjust HTML when website is in PHP

I have a Wordpress theme for a new website. I want to make some HTML adjustments but I realized that the website has only PHP scripts and of course the CSS file. For instance, I need to adjust the website name but cannot find H1 tags. I do not have any PHP knowledge. Please advice. Many thanks!
Screenshot
<?php echo "<div>html here</div>"; ?>
You can as many php chunks as you want
example :
<?php echo "<h1>html here</h2>"; ?>
<?php echo "<span>html here</span>"; ?>
Wordpress is a bit different from vanilla PHP instead of echoing out HTML with the title:
<?php echo "<h1>The Title</h1>"; ?>
It uses a function/hook called wp_title(); that you can find in header.php.
But to modify it you would have to in to functions.php and edit the function and for that you need some basic PHP knowledge.
Here is some documentation on the wp_title() function/hook.
https://developer.wordpress.org/reference/hooks/wp_title/

Php inside php to process custom field in wordpress

I have a code which returns gallery number 1 with the set of images.
<?php echo photo_gallery(1); ?>
But I need to change number "1" to number "2", "3" and so on with custom fields in every post using this code
<?php the_field('number'); ?>
inside the first code
I need something like this:
<?php echo photo_gallery( <?php the_field('number'); ?> ); ?>
Result:
<?php echo photo_gallery(2); ?>
or
<?php echo photo_gallery(3); ?>
Something like this?
<?php
echo photo_gallery(the_field('images'));
?>
You don't need nested PHP tags. Omit the php tags inside and your code should run.
<?php
echo photo_gallery(get_field('number'));
?>
Note the difference between get_field and the_field. ACF docs explain which to use in which situation.
Essentially, the functions inside (to the right) get executed first, returning a value which can be used by the outer function (to the left).
In the background, a programming language takes these steps:
execute get_field('one') and return 1.
execute photo_gallery(1) and return (photo).
echo (photo)
There are some courses on PHP, many of which are free - that might help you sort through some of these issues.

Add Google Plus in header in html.tpl.php

In html.tpl.php I have written :
<?php if($front_page):?>
<?php print 'Google+ '?>
<?php endif; ?>
but its not working moreover its hanging the home page.
Can someone please tell me the correct syntax if it has some error
Should you not be using echo instead of print?
<?php if(drupal_is_front_page()):
echo 'Google+';
endif; ?>
In most themes, you should be overriding page.tpl.php rather than html.tpl.php. You also have a couple of errors in your syntax. The typical code for a template would read:
<?php if($front_page): ?>
Google+
<?php endif; ?>
Note the space in the first line, plus you don't need to print the second.

magento customize html print order

I'm trying to customize the html print order (url http://www.yoursite.com/index.php/sales/order/print/order_id/8/ ) but I can't find the right file to do this.
I'm working on template/sales/order/print files but all the changes I made aren't visible.
could you please give me a hint?
Thanks a lot
Best regards
EDIT: ok, I've found the file that I need to modify, it is print-phtml in app/design/frontend/default/MYTEMPLATE/template/sales/order
Now I'd like to add product description in each row in this html print page, but I don't know how I can do this
There is
<?php $_items = $_order->getItemsCollection(); ?>
<?php $_count = $_items->count(); ?>
<?php foreach ($_items as $_item): ?>
<?php if ($_item->getParentItem()) continue; ?>
<tbody>
<?php echo $this->getItemHtml($_item) ?>
</tbody>
<?php endforeach; ?>
so I think that I have to modify something in $this->getItemHtml($_item) but I have no idea where is this getItemHtml
could you please help me? thanks a lot
The file you have to edit is the \sales\order\items\renderer\default.phtml , but changes you make here will also appear on the order view page.
To avoid this, you can use the following condition in this phtml (there is also an example in the original version):
<?php if ($this->getPrintStatus()): ?>
....
<?php endif;?>
.. and for similar issues in the future: on the admin panel, in System/Configuration menu if you switch to "Store view", you will find an option under Advanced/Developer tab called "Template path hints". If you set it to "yes", you will see the template pathes in the frontend, embedded inline next to each block. How to use template path hints

How to include PHP in template?

I'm trying to use WP Ultimate Search and it says:
Call the search bar with wp_ultimate_search_bar() Render the search
results area with wp_ultimate_search_results()
I tried <?php wp_ultimate_search_bar(); ?> with no luck.. any ideas?
Add both <?php echo wp_ultimate_search_bar(); ?> and <?php echo wp_ultimate_search_results(); ?> to .php file

Categories