LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-02-2006, 04:37 AM   #1
candela
LQ Newbie
 
Registered: Apr 2006
Posts: 5

Rep: Reputation: 0
PHP class extends.... with no memory?


hello,
i've build a simple class that read an xml file into an array,
look for a specific data
add an element
remove an element
save the all array into same or other file...
no problem about it :mrgreen:

now, i build some other class, to work on specific xml data file...
so i extend the previus class, and i add some method...
even this, it's ok on my local web server...
not the same on my host...
where, event if there's no error, the array became empty far away from the point i build it....

let me show u an example:
PHP Code:
<?php
session_start
();
// at the begginig i include some class
include_once("clMenu.php"); // that extends a my xml class...
$menu=new clMenu("_Xml/vmenu.xml"); // i have to indicate the xml file
?>

<!-- some HTML CODE -->

<? // now i use my class
echo $menu->showHtml();
?>
the xml class build a global array variable with data in it,
but when this method (showHtml), use this array, it see an array with 0 element, while i'm sure, at the moment it has been builded it has many element.... (and all works fine on my local web server!)

any idea?
 
Old 05-02-2006, 06:30 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
The first thought that comes to mind is your server able to open the file?
The second is that you said it built a global array variable, Why global, why not a member variable in your class?
 
Old 05-03-2006, 03:04 AM   #3
candela
LQ Newbie
 
Registered: Apr 2006
Posts: 5

Original Poster
Rep: Reputation: 0
i solved...
it seems like the use of a var, that i recall with the use of $this-> doesn't work...
but i have to redeclare it with global in every method... and then i can use it..

maybe there is something i miss in php logic...
 
Old 05-03-2006, 07:03 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Maybe you could show some code on how you were using $this->
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Are PHP session variables held in memory when you leave a PHP site? Locura Programming 11 11-16-2008 08:37 PM
class A extends B- where is paintComponent(Graphics) supposed to paint? kpachopoulos Programming 1 03-15-2006 06:28 AM
Cannot get PHP to include a class properly Dudydoo Programming 6 02-02-2006 01:03 PM
Allocate memory in class contructor Ephracis Programming 3 01-13-2005 10:50 AM
PHP: how to use a method from a class in the same class ldp Programming 5 09-17-2004 09:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration