Undefined index / variable error - SOLVED!

Everything to do with Joomla! 1.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
User avatar
violinar
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Jan 10, 2011 8:27 pm

Undefined index / variable error - SOLVED!

Post by violinar » Mon Jan 10, 2011 8:38 pm

When I install a new template to Joomla! Version 1.5.22, on my homepage above the content on the white background it says:

Notice: Undefined index: ALL_HTTP in /var/www/html/websitename/templates/nameofthetemplate/index.php on line 28

Notice: Undefined variable: user123 in /var/www/html/websitename/templates/nameofthetemplate/layouts/default/header.php on line 9

Notice: Undefined variable: user45 in /var/www/html/websitename/templates/nameofthetemplate/layouts/default/header.php on line 15

PHP on this server is : 5.2.13
Last edited by violinar on Tue Jan 11, 2011 10:50 am, edited 1 time in total.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44024
Joined: Sat Apr 05, 2008 9:58 pm

Re: Undefined index / variable when I install new template

Post by Webdongle » Mon Jan 10, 2011 8:41 pm

Local or remote install ?

Custom Template ?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
violinar
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Jan 10, 2011 8:27 pm

Re: Undefined index / variable when I install new template

Post by violinar » Mon Jan 10, 2011 8:52 pm

I've been installing Joomla! using FileZilla FTP Client.

Here I've found free templates http://www.joomla24.com/ which perfectly function on my other Joomla! (Version 1.5.21) website (which is on another server).

This server (where is Joomla! which has problems with installing new templates) is on Linux.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44024
Joined: Sat Apr 05, 2008 9:58 pm

Re: Undefined index / variable when I install new template

Post by Webdongle » Mon Jan 10, 2011 8:54 pm

Look at Joomla admin >>>> Help >>> System info ... Directory permissions Tab

What does it say ?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
violinar
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Jan 10, 2011 8:27 pm

Re: Undefined index / variable when I install new template

Post by violinar » Mon Jan 10, 2011 9:01 pm

Everything was writable (today afternoon) but still I keep receiving those annoying notes. This evening I've reinstalled Joomla! but everything became unwritable with the same annoying notes on the website page (after installing new templates). Right now I'm making everything writable again, and I will let you know if anything changed (but I doubt that Undefined index / variable notes are gone).

I was searching a lot on Joomla! forum for the answer, but it seams that I'm the only one who get Undefined index / variable notes after installing new templates...

I must tell you that each template has it's own note. Here is another message which I keep receiving above the content:

Notice: Undefined variable: my in /var/www/html/websitename/templates/templatename/index.php on line 34

Notice: Trying to get property of non-object in /var/www/html/websitename/templates/templatename/index.php on line 34

User avatar
violinar
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Jan 10, 2011 8:27 pm

Re: Undefined index / variable when I install new template

Post by violinar » Mon Jan 10, 2011 9:17 pm

Webdongle wrote:Look at Joomla admin >>>> Help >>> System info ... Directory permissions Tab

What does it say ?
Everything is writable.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44024
Joined: Sat Apr 05, 2008 9:58 pm

Re: Undefined index / variable when I install new template

Post by Webdongle » Mon Jan 10, 2011 9:39 pm

It appears that your Template is asking for a variable that it (or one of it's files) did not define. Either because the person who designed the Template forgot to put it in or because the index.php file can not find/read the file it is defined in.

http://en.wikipedia.org/wiki/Undefined_variable
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
violinar
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Jan 10, 2011 8:27 pm

Re: Undefined index / variable when I install new template

Post by violinar » Mon Jan 10, 2011 9:43 pm

Webdongle wrote:It appears that your Template is asking for a variable that it (or one of it's files) did not define. Either because the person who designed the Template forgot to put it in or because the index.php file can not find/read the file it is defined in.

http://en.wikipedia.org/wiki/Undefined_variable
With every template which I install I receive notes/errors. So, I doubt that all of the designers made the same mistake.

If index.php can't find/read the file, what should I do?

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44024
Joined: Sat Apr 05, 2008 9:58 pm

Re: Undefined index / variable when I install new template

Post by Webdongle » Mon Jan 10, 2011 9:52 pm

It must be a path or permissions issue

What is the url ?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
violinar
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Jan 10, 2011 8:27 pm

Re: Undefined index / variable when I install new template

Post by violinar » Mon Jan 10, 2011 9:59 pm

Webdongle wrote:It must be a path or permissions issue

What is the url ?
Last edited by violinar on Tue Jan 11, 2011 10:21 am, edited 1 time in total.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44024
Joined: Sat Apr 05, 2008 9:58 pm

Re: Undefined index / variable when I install new template

Post by Webdongle » Mon Jan 10, 2011 10:16 pm

The output is

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<br />
<b>Notice</b>:  Use of undefined constant _LANGUAGE - assumed '_LANGUAGE' in <b>/var/www/html/stradivari/templates/morit/index.php</b> on line <b>25</b><br />
_LANGUAGE" xml:lang="<br />
<b>Notice</b>:  Use of undefined constant _LANGUAGE - assumed '_LANGUAGE' in <b>/var/www/html/stradivari/templates/morit/index.php</b> on line <b>25</b><br />
_LANGUAGE">

<head>

So it is complaining about (see the line ?

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>

Then it complains about

Code: Select all

<script type="text/javascript" src="/media/system/js/caption.js"></script>

	<br />
<b>Notice</b>:  Undefined variable: my in <b>/var/www/html/stradivari/templates/morit/index.php</b> on line <b>36</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>/var/www/html/stradivari/templates/morit/index.php</b> on line <b>36</b><br />

	<meta http-equiv="Content-Type" content="text/html; <br />
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
violinar
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Jan 10, 2011 8:27 pm

Re: Undefined index / variable when I install new template

Post by violinar » Tue Jan 11, 2011 9:25 am

Thank you Webdongle. Could you tell me how can I fix that? Which file (index.php ?) should I edit (and which information should I type)?

User avatar
kurchania
Joomla! Hero
Joomla! Hero
Posts: 2070
Joined: Mon Sep 21, 2009 6:56 am
Location: indore,india
Contact:

Re: Undefined index / variable when I install new template

Post by kurchania » Tue Jan 11, 2011 9:31 am

hi violinar,
in live site you you want to show the warning and message.not a good practice.
open
/var/www/html/stradivari/templates/morit/index.php
after line
defined( '_JEXEC' ) or die( 'Restricted access' );
add this line

Code: Select all

error_reporting(0);
Regards
Abhijeet
abhijeet kurchania
The future depends on what you do today

User avatar
violinar
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Jan 10, 2011 8:27 pm

Re: Undefined index / variable when I install new template

Post by violinar » Tue Jan 11, 2011 10:17 am

Thank you Abhijeet! You solve the problem!
Now I apply that code to all new templates which I install...

User avatar
kurchania
Joomla! Hero
Joomla! Hero
Posts: 2070
Joined: Mon Sep 21, 2009 6:56 am
Location: indore,india
Contact:

Re: Undefined index / variable when I install new template

Post by kurchania » Tue Jan 11, 2011 10:39 am

hi violinar,
also you can go to
http://docs.joomla.org/Screen.config.15#Server
you can see error_reporting option there.
make it to none.
please close the topic by marking right button or write at header solved.

Regards
Abhijeet
abhijeet kurchania
The future depends on what you do today

User avatar
violinar
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Jan 10, 2011 8:27 pm

Re: Undefined index / variable when I install new template

Post by violinar » Tue Jan 11, 2011 10:49 am

Done! Thanks again!

Edylici
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Jul 22, 2011 4:44 am

Re: Undefined index / variable when I install new template

Post by Edylici » Fri Jul 22, 2011 5:00 am

Webdongle wrote:Local or remote install ?

Custom Template ?
Hy...i have the same problem with joomla 1.5 im using themza_j15_26 ... *


Notice: Undefined variable: title in C:\wamp\www\Joomla 1.5.23\templates\themza_j15_26\functions.php on line 172

how do i fix it ???pls help

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44024
Joined: Sat Apr 05, 2008 9:58 pm

Re: Undefined index / variable error - SOLVED!

Post by Webdongle » Fri Jul 22, 2011 11:20 am

http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".


Locked

Return to “Templates for Joomla! 1.5”