Reputation: 23
When I view my Open Cart theme on a mobile screen size I get the following error:
Notice: Undefined variable: text_toplinks in /home/content/76/11344876/html/shop/catalog/view/theme/cs-onestar/template/common/header.tpl on line 91
when I go into the file I see the following on line 91:
<span><?php echo $text_toplinks; ?></span>
I'm not sure how to get the $text_toplink
to say "Menu" or simple "Top Menu".
I'm new to the whole PHP and Open Cart stuff I'm used to CSS and HTML and have extensive knowledge on both but this is really mind boggling me because I can't seem to find an answer.
Upvotes: 2
Views: 264
Reputation: 18511
This is what I would do. It will check to see if the variable is set, before printing it out, which will prevent you from getting that notice. https://www.php.net/isset
<span><?php
if(isset($text_toplinks)){
echo $text_toplinks;
}
?></span>
Upvotes: 1
Reputation: 6349
It means there is no value coming inside your php variable $text_toplinks; and its not defined anywhere during the execute of your code.
If you'll provide more code(from where the $text_toplinks; is expected to coming) then there would be easy to find out the problem.
Upvotes: 0