i got alot of these messages
Notice: Undefined variable: config_facontact_address in /home/oclasico/public_html/catalog/view/theme/shoppa/template/common/footer.tpl on line 50
i already seen this answer
Undefined variable (opencart)
, and i tried to do it , but i didn`t find the code to replace :(
and here is my footer.tpl line 50 look like
<?php if ($config_facontact_address) { ?>
<div class="address"><?php echo $config_facontact_address; ?></div>
<?php } ?>
my OpenCart Version 1.5.4
thanks
variable $config_facontact_address is not set,
to avoid this error use if(isset($config_facontact_address))
The reason why it's undefined is because it hasn't been set in the controller file first.
Opencart uses the MVC architecture, varibles are defined in the Controller, then used within the Template / View files. For this reason, it will always evaluate false using isset()
The code missing from the controller file (located: catalog/controller/common/footer.php) would be:
$this->data['config_facontact_address'] = $this->config->get('config_facontact_address');
If your not comfortable editing the controller, then you can replace your problem code with this:
<?php if ($this->config->get('config_facontact_address')) { ?>
<div class="address"><?php echo $this->config->get('config_facontact_address'); ?></div>
<?php } ?>
Related
I have tried to call the function "#include('includes.updates')" and it throws me the error "ErrorException
Undefined variable: updates"
In hompage there are other functions like " #include('includes.listing-creators')" that when called work normally but I don't know why "include.updates" doesn't work.
#if ($updates->total() != 0)
<div class="grid-updates position-relative" id="updatesPaginator">
#include('includes.updates')
</div>
#endif
The code "#include('includes.updates')" should call the list of posts published by users, it is not working on homepage as I mentioned before. Could someone help me how to call the function to make it work on homepage?
I share link of the code that I am using and I want to modify:
https://codecanyon.net/item/sponzy-support-creators-content-script/28416726
i have figured out some blade templates (laravel) like #section('title', getOption('app_name') . ' - Login')
#section('body') as its real php formis <?php $__env->startSection('title', getOption('app_name') . ' - login'); ?>
<?php $__env->startSection('content'); ?> . and these are correct ,,
But i wanna know the real php form of #extends(layouts.app) .
anybody got an Idea ?
All of your compiled blade views are stored in storage/framework/views/ if you want to dig around and try to understand how Laravel turns a blade template into php.
It looks like your views define the sections first, then pass them to the layout
as variables. Inside your view which #extends(layouts.app) you might see this at the end:
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
The sections were defined before that line and passed as variables. When you look inside the layout itself, you'll see things like this for including each of those sections:
<?php echo $__env->yieldContent('content'); ?>
We just launched a redesign of a client's ecommerce site running on OpenCart. We're trying to track down an error we're seeing in the Error Logs, but it's been eluding us thus far:
PHP Notice: Undefined index: route in .../vqmod/vqcache/vq2-catalog_view_theme_margaretha_template_common_header.tpl on line 360
The code on that line is:
<?php if ($this->request->get['route'] != 'common/home') { ?>
<div id="free-shipping">
<p>Free shipping on all orders!</p>
</div>
<?php } ?>
I'm not sure why this is throwing an error. Any ideas?
Change your if condition as follows:
<?php if (isset($this->request->get['route']) && $this->request->get['route'] != 'common/home') { ?>
<div id="free-shipping">
<p>Free shipping on all orders!</p>
</div>
<?php } ?>
The code may be in your theme folder's common/header.tpl or in some vqmod xml file (editing the file /vqmod/vqcache/vq2-catalog_view_theme_margaretha_template_common_header.tpl won't make any change).
Have a nice day !!
This is my very first question at StackOverflow.
I was trying to post comment in the post Can a Joomla module "know" what position it's in?, but could find no way to do that so I have to post another question here. Any tips regarding how to do this properly is greatly apprieciated.
Anyway, here is my questions:
I tried the code mentioned in the above post but it seemed didn't work. I'm not only quite new to PHP, but also coding, so I'm not sure if it's me or the code. here's what I did to the module's default.php file:
1)to ensure I insert the code at the right place, I insert
<?php echo(print_r($module)); ?>
and it output 1 at the right position;
2)the position-name that I need to determine is "showcase-a", so I insert code
<?php if ($module->position == 'showcase-a'):?>test<?php endif;?>
to the above place, but this time it does't show anything;
3)then I tried this code:
<?php if ($module):?><span>test</span><?php endif; ?>
But still it does't display "test" at the position as I expected.
4)I tried
<?php if (1):?><span>test</span><?php endif; ?>
and the test "test" displays as good. So I didn't code the IF statement wrong.
Now I'm totally lost. Since print_r($module) outputs 1, $module must be positive, why PHP ignore test in 3)? This is just a side question for the sake of PHP learning. What I still need to solve is let the module determine which position itself is in.
Please help. Thank you!
I'm not sure about using it in the template (although it doesn't seem wrong altogether) but my modules oftentimes access the position like this:
$module->position
in the module (so mod_something.php) so try to put it there, if it's available just set a variable and it will be available in the view too.
If $module->position didn't work for you. $module->position may only work for joomla 1.7, 2.5 and + but i'm not sure. $module->position works in joomla 2.5.
Otherwise you need to make a module.php function
Check out the file
/templates/you-template/html/modules.php
For example you make your position the following in your template (for example index.php)
<jdoc:include type="modules" name="header" style="includeposition" />
inside of
/templates/you-template/html/modules.php
You make a function like this :
<?php
function modChrome_includeposition($module, &$params, &$attribs){
//Set a value to $module->position
$module->position='WHATEVER YOUWANT';
?>
<div class="moduletable <?php echo $params->get('moduleclass_sfx').' '.$module->name; ?>">
<?php
if($module->showtitle){
?>
<div class="modtitle">
<div class="fleche">
<span>
<?php
echo $module->title;
?>
</span>
</div>
</div>
<?php
}
?>
<div class="modcontent">
<?php echo $module->content; ?>
<div class="clear">
</div>
</div>
</div>
<?php
}
?>
make different functions names that sets different values if needed.
the function name will match the syle you set:
modChrome_includeposition($module, &$params, &$attribs)
because
style="includeposition"
inside of your jdoc.
I write custom Drupal module. Want show field_myear in contents. With the following:
<div class="right">
<h4>'.$m_detail->title.'</h4>
<div class="section">'.$field_myear.'</div>
<div class="description">
<div
But when refresh page, get this error:
Notice: theme_news()/home/domains/site.net/public_html/sites/all/modules/site/theme.module dosyasının 1247 satırı) içinde Undefined variable: field_myear.
How can i fix it?
Follow the execution of your page. Step through it line by line. When you are outputting the HTML shown above, you haven't got a value set for field_myear. You need to be sure you are setting it prior to trying to output it - or you need to check your variable name to make certain that it is correct and doesn't have a typo in it.