Page 1 of 1
Any php gurus out there? Just a quick php question, honest!
Posted: Tue Jan 22, 2013 5:24 am
by Lisaweb
Howdy! I have a custom theme that already has a custom footer enabled by the following code:
Code: Select all
<?php if($this->config->get('tg_evisu_footer_status') == '1'): ?>
But I need to combine it with this code, so that my footer will only show up on my homepage:
Code: Select all
if (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'') {
I tried the following but got a php error: Parse error: syntax error, unexpected T_LOGICAL_AND
Code: Select all
<?php if($this->config->get('tg_evisu_footer_status') == '1')
AND (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home''): ?>
What am I doing wrong? Thanks in advance for any help you can provide!
Re: Any php gurus out there? Just a quick php question, hone
Posted: Tue Jan 22, 2013 5:55 am
by Malaiac
try && (double ampersand) instead of AND
I don't think AND is a proper operator in php syntax

Re: Any php gurus out there? Just a quick php question, hone
Posted: Tue Jan 22, 2013 6:02 am
by Lisaweb
Malaiac wrote:try && (double ampersand) instead of AND
I don't think AND is a proper operator in php syntax

Sorry, I tried that too, and got an error, unexpected T_BOOLEAN_AND.
Re: Any php gurus out there? Just a quick php question, hone
Posted: Tue Jan 22, 2013 6:18 am
by Xsecrets
you are missing an opening ( after the if. Since you added the ) after == '1' you have to add another ( before that condition.
edit actually you've got the parethesis all screwed up try this with them all fixed.
Code: Select all
<?php if(($this->config->get('tg_evisu_footer_status') == '1')
&& (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'')) { ?>
Re: Any php gurus out there? Just a quick php question, hone
Posted: Tue Jan 22, 2013 6:18 am
by Lisaweb
Here is a snippet of my current code that I am trying to alter, if it helps:
Code: Select all
<?php if($this->config->get('tg_evisu_footer_status') == '0'): ?>
<div id="footerimage"> </div>
<?php endif; ?>
<div id="footer">
<?php if($this->config->get('tg_evisu_footer_status') == '1'): ?>
<div id="footer-main">
Re: Any php gurus out there? Just a quick php question, hone
Posted: Tue Jan 22, 2013 10:57 pm
by Lisaweb
I posted the same time as you and didn't see your reply until now. I tried your code suggestion but got the following error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
Here is the area of the footer I am trying to use it in, if it helps. Any ideas?
Code: Select all
<?php if($this->config->get('tg_evisu_footer_status') == '0'): ?>
<div id="footerimage"> </div>
<?php endif; ?>
<div id="footer">
<?php if(($this->config->get('tg_evisu_footer_status') == '1')
&& (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'')) { ?>
<div id="footer-main">
<div id="footer-inner">
Xsecrets wrote:you are missing an opening ( after the if. Since you added the ) after == '1' you have to add another ( before that condition.
edit actually you've got the parethesis all screwed up try this with them all fixed.
Code: Select all
<?php if(($this->config->get('tg_evisu_footer_status') == '1')
&& (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'')) { ?>
Re: Any php gurus out there? Just a quick php question, hone
Posted: Tue Jan 22, 2013 11:20 pm
by Xsecrets
Lisaweb wrote:I posted the same time as you and didn't see your reply until now. I tried your code suggestion but got the following error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
Here is the area of the footer I am trying to use it in, if it helps. Any ideas?
Code: Select all
<?php if($this->config->get('tg_evisu_footer_status') == '0'): ?>
<div id="footerimage"> </div>
<?php endif; ?>
<div id="footer">
<?php if(($this->config->get('tg_evisu_footer_status') == '1')
&& (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'')) { ?>
<div id="footer-main">
<div id="footer-inner">
Xsecrets wrote:you are missing an opening ( after the if. Since you added the ) after == '1' you have to add another ( before that condition.
edit actually you've got the parethesis all screwed up try this with them all fixed.
Code: Select all
<?php if(($this->config->get('tg_evisu_footer_status') == '1')
&& (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'')) { ?>
doh left an errant '
Code: Select all
<?php if(($this->config->get('tg_evisu_footer_status') == '1')
&& (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home')) { ?>
Re: Any php gurus out there? Just a quick php question, hone
Posted: Tue Jan 22, 2013 11:41 pm
by Lisaweb
Xsecrets, thank you so much for your help!
Unfortunately that brought yet another error:
Parse error: syntax error, unexpected T_ENDIF in /home/public_html/catalog/view/theme/evisu/template/common/footer.tpl on line 197.
Line 197 has: <?php endif; ?>
All I am doing is replacing this line with your code:
Code: Select all
<?php if($this->config->get('tg_evisu_footer_status') == '1'): ?>
Here is the complete footer file (without the new code), maybe by seeing the whole thing you can see what is causing this?
Again, thanks for your help!
Code: Select all
</div>
<?php if($this->config->get('tg_evisu_footer_status') == '0'): ?>
<div id="footerimage"> </div>
<?php endif; ?>
<div id="footer">
<?php if($this->config->get('tg_evisu_footer_status') == '1'): ?>
<div id="footer-main">
<div id="footer-inner">
<!-- information column -->
<?php if($this->config->get('tg_evisu_footer_footer_info_enabled') == '1'): ?>
<div class="column_<?php echo 12 / ($this->config->get('tg_evisu_footer_footer_info_enabled') + $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')); ?>">
<div class="header_<?php echo 12 / ($this->config->get('tg_evisu_footer_footer_info_enabled') + $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')); ?>"><?php echo $this->config->get('mymodule_title' . $this->config->get('config_language_id')); ?></div>
<?php echo html_entity_decode($this->config->get('mymodule_code' . $this->config->get('config_language_id')));?>
</div> <!-- class column (end) -->
<?php endif; ?>
<!-- contact us column -->
<?php if($this->config->get('tg_evisu_footer_footer_contacts_enabled') == '1'): ?>
<div class="column_<?php echo 12 / ($this->config->get('tg_evisu_footer_footer_info_enabled') + $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')); ?>">
<div class="header_<?php echo 12 / ($this->config->get('tg_evisu_footer_footer_info_enabled') + $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')); ?>"><?php echo $this->config->get('mymodule_title2' . $this->config->get('config_language_id')); ?></div>
<?php if ($this->config->get('tg_evisu_footer_phone_show') == "1") { ?>
<img src="catalog/view/theme/evisu/image/homephone-icon.png" alt="Toll Free" /> <?php echo $this->config->get('tg_evisu_footer_phone'); ?><br />
<?php } ?>
<?php if ($this->config->get('tg_evisu_footer_mobile_show') == "1") { ?>
<img src="catalog/view/theme/evisu/image/phone-icon.png" alt="Local" /> <?php echo $this->config->get('tg_evisu_footer_mobile'); ?><br />
<?php } ?>
<?php if ($this->config->get('tg_evisu_footer_email_show') == "1") { ?>
<img src="catalog/view/theme/evisu/image/email-icon.png" alt="Fax" /> <?php echo $this->config->get('tg_evisu_footer_email'); ?><br />
<?php } ?>
<?php if ($this->config->get('tg_evisu_footer_skype_show') == "1") { ?>
<img src="catalog/view/theme/evisu/image/skype-icon.png" alt="" /> <?php echo $this->config->get('tg_evisu_footer_skype'); ?><br />
<?php } ?>
<?php if ($this->config->get('tg_evisu_footer_address_show') == "1") { ?>
<img src="catalog/view/theme/evisu/image/address-icon.png" alt="Address" /> <?php echo $this->config->get('tg_evisu_footer_address'); ?><br />
<?php } ?>
<br/>
<div class="header_social_<?php echo 12 / ($this->config->get('tg_evisu_footer_footer_info_enabled') + $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')); ?>"><?php echo $this->config->get('mymodule_title2b' . $this->config->get('config_language_id')); ?></div>
<div class="column2">
<ul>
<li>
<?php if ($this->config->get('tg_evisu_footer_facebook_show') == "1") { ?>
<a href="<?php echo $this->config->get('tg_evisu_footer_facebook');?>" title="Facebook" target="_blank"> <img src="catalog/view/theme/evisu/image/facebook.png" alt="Facebook" /> </a>
<?php } ?>
<?php if ($this->config->get('tg_evisu_footer_twitter_show') == "1") { ?>
<a href="<?php echo $this->config->get('tg_evisu_footer_twitter');?>" title="Twitter" rel="author" target="_blank"> <img src="catalog/view/theme/evisu/image/twitter.png" alt="Twitter" /> </a>
<?php } ?>
<?php if ($this->config->get('tg_evisu_footer_myspace_show') == "1") { ?>
<a href="<?php echo $this->config->get('tg_evisu_footer_myspace');?>" title="LinkedIn" target="_blank"> <img src="catalog/view/theme/evisu/image/linkedin.png" alt="LinkedIn" /> </a>
<?php } ?>
<?php if ($this->config->get('tg_evisu_footer_flickr_show') == "1") { ?>
<a href="<?php echo $this->config->get('tg_evisu_footer_flickr');?>" title="Google Plus" rel="publisher" target="_blank"> <img src="catalog/view/theme/evisu/image/gplus.png" alt="Google Plus" /> </a>
<?php } ?>
<?php if ($this->config->get('tg_evisu_footer_youtube_show') == "1") { ?>
<a href="<?php echo $this->config->get('tg_evisu_footer_youtube');?>" title="Youtube" target="_blank"> <img src="catalog/view/theme/evisu/image/youtube.png" alt="Youtube" /> </a>
<?php } ?>
</li>
</ul>
</div>
</div> <!-- class column (end) -->
<?php endif; ?>
<!-- twitter column -->
<?php if($this->config->get('tg_evisu_footer_footer_twitter_enabled') == '1'): ?>
<div class="column_<?php echo 12 / ($this->config->get('tg_evisu_footer_footer_info_enabled') + $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')); ?>">
<div class="header_<?php echo 12 / ($this->config->get('tg_evisu_footer_footer_info_enabled') + $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')); ?>"><?php echo $this->config->get('mymodule_title3' . $this->config->get('config_language_id')); ?></div>
<div id="twitter" >
<ul id="twitter_update_list"></ul>
<script src="//twitter.com/javascripts/blogger.js" type="text/javascript"></script>
<script src="//api.twitter.com/1/statuses/user_timeline/<?php echo $this->config->get('tg_evisu_footer_twitter_username'); ?>.json?callback=twitterCallback2&count=<?php echo $this->config->get('tg_evisu_footer_tweets'); ?>" type="text/javascript"></script>
</div><!-- twitter (end) -->
</div><!-- column (end) -->
<?php endif; ?>
<?php if($this->config->get('tg_evisu_footer_footer_facebookfp_enabled') == '1'): ?>
<div class="column_<?php echo 12 / ($this->config->get('tg_evisu_footer_footer_info_enabled') + $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')); ?>">
<div class="header_<?php echo 12 / ($this->config->get('tg_evisu_footer_footer_info_enabled') + $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')); ?>"><?php echo $this->config->get('mymodule_title4' . $this->config->get('config_language_id')); ?>
<div class="s_widget_holder">
<?php if ($this->config->get('tg_evisu_cp_default_color') =='stylesheet-glossy-light') {?>
<fb:fan profileid="<?php echo $this->config->get('tg_evisu_footer_facebook_id'); ?>" stream="0"
connections=9" logobar="0" width="<?php echo ((12 / ($this->config->get('tg_evisu_footer_footer_info_enabled')
+ $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')))*80) - 20; ?>" height="330"
css="<?php echo HTTPS_SERVER; ?>catalog/view/theme/evisu/stylesheet/facebooklight.css.php?510"></fb:fan>
<?php } else if ($this->config->get('tg_evisu_cp_default_color') =='stylesheet-standard-light') {?>
<fb:fan profileid="<?php echo $this->config->get('tg_evisu_footer_facebook_id'); ?>" stream="0"
connections="9" logobar="0" width="<?php echo ((12 / ($this->config->get('tg_evisu_footer_footer_info_enabled')
+ $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')))*80) - 20; ?>" height="330"
css="<?php echo HTTPS_SERVER; ?>catalog/view/theme/evisu/stylesheet/facebooklight.css.php?510"></fb:fan>
<?php } else {?>
<fb:fan profileid="<?php echo $this->config->get('tg_evisu_footer_facebook_id'); ?>" stream="0"
connections="9" logobar="0" width="<?php echo ((12 / ($this->config->get('tg_evisu_footer_footer_info_enabled')
+ $this->config->get('tg_evisu_footer_footer_contacts_enabled') + $this->config->get('tg_evisu_footer_footer_twitter_enabled') + $this->config->get('tg_evisu_footer_footer_facebookfp_enabled')))*80) - 20; ?>" height="330"
css="<?php echo HTTPS_SERVER; ?>catalog/view/theme/evisu/stylesheet/facebook.css.php?510"></fb:fan>
<?php } ?>
</div>
</div>
</div>
<?php endif; ?>
<?php if($this->config->get('tg_evisu_footer_footer_facebookfp_enabled') == '1'): ?>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: '0c18007de6f00f7ecda8c040fb76cd90', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<?php endif; ?>
</div> <!-- footer-holder (end) -->
<!-- DEFAULT FOOTER -->
<?php if ($this->config->get('tg_evisu_footer_default_show') == "1") { ?>
<div class="footer-default">
<?php if ($informations) { ?>
<div class="column">
<h3><?php echo $text_information; ?></h3>
<ul>
<?php foreach ($informations as $information) { ?>
<li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li>
<?php } ?>
</ul>
</div>
<?php } ?>
<div class="column">
<h3><?php echo $text_service; ?></h3>
<ul>
<li><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li>
<li><a href="<?php echo $return; ?>"><?php echo $text_return; ?></a></li>
<li><a href="<?php echo $sitemap; ?>"><?php echo $text_sitemap; ?></a></li>
</ul>
</div>
<div class="column">
<h3><?php echo $text_extra; ?></h3>
<ul>
<li><a href="<?php echo $manufacturer; ?>"><?php echo $text_manufacturer; ?></a></li>
<li><a href="<?php echo $voucher; ?>"><?php echo $text_voucher; ?></a></li>
<li><a href="<?php echo $affiliate; ?>"><?php echo $text_affiliate; ?></a></li>
<li><a href="<?php echo $special; ?>"><?php echo $text_special; ?></a></li>
</ul>
</div>
<div class="column">
<h3><?php echo $text_account; ?></h3>
<ul>
<li><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li>
<li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li>
<li><a href="<?php echo $wishlist; ?>"><?php echo $text_wishlist; ?></a></li>
<li><a href="<?php echo $newsletter; ?>"><?php echo $text_newsletter; ?></a></li>
</ul>
</div>
</div> <!-- footer-default (end) -->
<?php } ?>
</div><!-- footer-inner (end) -->
</div><!-- footer-main (end) -->
<?php endif; ?>
<div class="clear"> </div>
<div id="footerimage">
<div id="powered">© <?php echo date("Y") ?> TSDD, Inc. All rights reserved worldwide.
</div>
<div id="paymentimage">
<?php if (unserialize($this->config->get('tg_evisu_paymentimages_slide_image'))) {?>
<?php foreach( unserialize($this->config->get('tg_evisu_paymentimages_slide_image')) as $image): ?>
<?php if ($image['url']) {?>
<span style="margin-left:10px;"><a href="<?php echo $image['url'];?>" target="_blank"><img src="<?php echo HTTPS_SERVER . 'image/' . $image['file'];?>" alt="" /></a></span>
<?php } else { ?>
<span style="margin-left:10px;"><img src="<?php echo HTTPS_SERVER . 'image/' . $image['file'];?>" alt="" /></span>
<?php } ?>
<?php endforeach; ?>
<?php } ?>
</div> <!-- paymentimage (end) -->
</div> <!-- footerimage (end) -->
</div>
Re: Any php gurus out there? Just a quick php question, hone
Posted: Wed Jan 23, 2013 12:40 am
by Xsecrets
ahh you are using the alternate php syntax. replace the { in my code with :
I never use the alternate syntax and assumed that was an errant semicolon at the end of your original line.
Re: Any php gurus out there? Just a quick php question, hone
Posted: Wed Jan 23, 2013 1:18 am
by Lisaweb
Tried your code
Code: Select all
<?php if(($this->config->get('tg_evisu_footer_status') == '1')
&& (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'')): ?>
,
Got this error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/public_html/catalog/view/theme/evisu/template/common/footer.tpl on line 16
Re: Any php gurus out there? Just a quick php question, hone
Posted: Wed Jan 23, 2013 1:27 am
by Xsecrets
Lisaweb wrote:Tried your code
Code: Select all
<?php if(($this->config->get('tg_evisu_footer_status') == '1')
&& (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'')): ?>
,
Got this error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/public_html/catalog/view/theme/evisu/template/common/footer.tpl on line 16
well you made the change to the code block before the last one I posted. The one that still had the extra ' in it. Try this
Code: Select all
<?php if(($this->config->get('tg_evisu_footer_status') == '1')
&& (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home')): ?>
Re: Any php gurus out there? Just a quick php question, hone
Posted: Wed Jan 23, 2013 1:48 am
by Lisaweb
Yay! That worked! --- Only, while it took away the custom footer on all pages but the home page (which is what I needed) -- it also took the
default footer away too. It is called out further down in the footer.tpl by this code:
Code: Select all
<?php if ($this->config->get('tg_evisu_footer_default_show') == "1") { ?>
<div class="footer-default">
How do I get it to show up on all the pages?
Thanks again for your help!
-Lisa
Re: Any php gurus out there? Just a quick php question, hone
Posted: Wed Jan 23, 2013 3:17 am
by Xsecrets
I don't really know what to tell you on that one. You could always move it out of the if statement, but depending on the html structure that would most likely break things. There is no way to make anything inside an if statement show up if the condition is not true. I suppose you could split your if statement and wrap all the code before that in one and all the code after that in another one. Sorry, but there is no one simple easy solution to that conundrum.
Re: Any php gurus out there? Just a quick php question, hone
Posted: Wed Jan 23, 2013 4:09 am
by Avvici
Lisaweb wrote:Yay! That worked! --- Only, while it took away the custom footer on all pages but the home page (which is what I needed) -- it also took the
default footer away too. It is called out further down in the footer.tpl by this code:
Code: Select all
<?php if ($this->config->get('tg_evisu_footer_default_show') == "1") { ?>
<div class="footer-default">
How do I get it to show up on all the pages?
Thanks again for your help!
-Lisa
I don't see the big complication here. Just use }else{ to echo out anything that "like xsecrets said" does not return TRUE
And, you an always use != for procedures which is helpful.