471,122 Members | 1,148 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

PHP - Joomla variable $A not recognized

3
Working with PHP script and Joomla - When I define a variable in the script (see example 1 below), install the compoment in joomla, select the menu item, nothing happens. The error log says:

PHP Notice: Undefined variable: act in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\joomla\\components\ \com_ectpequipmentlist\\ectpequipmentlist.php on line 37, referer: http://localhost/joomla/index.php

If I hard code a value in the default option of the script (see example 2), install the compoment, select the menu item the data appears correctly.

Example 1: Code that does not work:[php]global $database;
echo 'made it here';

include("class/ectpequipmentlist.php");
$EL = new EquipmentList();
switch( $act )
{
case 'search':
$EL->searchPosition($buildingid, $floor, $pos);
break;
case 'view':
$EL->viewPosition($positionid);
break;
default:
$EL->searchForm();
break;
}[/php]Example 2: Code that does work:[php]global $database;
include("class/ectpequipmentlist.php");
$EL = new EquipmentList();
switch( $act )
{
case 'search':
$EL->searchPosition($buildingid, $floor, $pos);
break;
case 'view':
$EL->viewPosition($positionid);
break;
default:
$EL->viewPosition('200');
break;
}[/php]
Apr 16 '08 #1
5 2344
ronverdonk
4,258 Expert 4TB
It most likely is not an error, but a notice or warning. Just means that you use a variable that has not been declared/initialized. It is always better to do that.

You can ignore this notice or set notices off completely in your PHP script.

Ronald
Apr 16 '08 #2
Markus
6,050 Expert 4TB
Using PHP and Joomla - a define a variable run menu in Joomla and the error log says: Undefined variable in php script file. If I hard code a value the menu works correctly.

What missing?
You can add the @ symbol at the begging of the variable, to surpress an error.
Apr 16 '08 #3
dkas
3
It most likely is not an error, but a notice or warning. Just means that you use a variable that has not been declared/initialized. It is always better to do that.

You can ignore this notice or set notices off completely in your PHP script.

Ronald
I'm a newbie. I added some additional information to my post. Thank you for the reponse. If you could look at the post again that would be great.
Apr 16 '08 #4
dkas
3
You can add the @ symbol at the begging of the variable, to surpress an error.
Thank you for responding. I added some additonal information. I'm a newbie and I cannot get the code to work correctly unless I hard code a value.
Apr 16 '08 #5
ronverdonk
4,258 Expert 4TB
WARNING:
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Apr 16 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by KCC | last post: by
14 posts views Thread by Osiris | last post: by
9 posts views Thread by walterbyrd | last post: by
1 post views Thread by Phil | last post: by
18 posts views Thread by Shelly | last post: by
4 posts views Thread by st3znmvg3yzo6atl45l8 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.