The Joomla! Forum ™





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
PostPosted: Wed Dec 14, 2005 10:54 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Sep 07, 2005 10:18 pm
Posts: 617
Location: London
to do with users in this case

function userEdit( $row, $option, $submitvalue, &$params )

I've never come across this syntax for an argument, how is it used? what will it change?


also what does this do

require_once ( $mainframe->getPath( 'front_html' ) );

thanks
m :)

_________________
Check out the 'bad toilet' online !


Last edited by mojito on Wed Dec 14, 2005 11:42 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Dec 15, 2005 5:37 am 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Mon Dec 05, 2005 10:17 am
Posts: 1367
Location: New Orleans, LA, USA
In your first question, are you asking how to pass an argument to a function?  Or something else?

As for the second question.

require_once ( $mainframe->getPath( 'front_html' ) );

Is saying that this file, is trying to include another file, which is the nave of the component.html.php.  front_html is basically an internal variable constant referring to the components .html.php file, which is used normally to do the actual html presentation. 

_________________
Rob Schley - Open Source Matters
Webimagery - http://www.webimagery.net/ - Professional Consulting Services
JXtended - http://www.jxtended.com/ - Free and Commercial Joomla! Extensions


Top
 Profile  
 
PostPosted: Thu Dec 15, 2005 10:32 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Sep 07, 2005 10:18 pm
Posts: 617
Location: London
That helps me a lot as I couldnt see any includes for the components constructed with html.php files and .php files, that must be the line.

For the first part the bit I dont get is the "&" just before the argument$params, does this concatenate the current $params with new $params ?

thanks

c

_________________
Check out the 'bad toilet' online !


Top
 Profile  
 
PostPosted: Fri Dec 16, 2005 3:48 am 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Mon Dec 05, 2005 10:17 am
Posts: 1367
Location: New Orleans, LA, USA
A '&' in php is actually used to pass a variable as a reference, so &$params means pass the memory location of $params, instead of making a copy of $params for that function.  It is intended to cut down on unnecessary memory usage, and to make your program faster.  However, it is optional.  It would be ok to pass $params as the argument, however, if you do any changes to the $params variable inside your function, you will have to return $params upon completion, and update it outside of the function.  So, in most cases, it is easier and faster to pass it as a reference using the & operator.  Of course, there are instances when this is not ideal, and it is better to pass a copy of %params instead of having the function use a global $params.

Hope that helps. 

_________________
Rob Schley - Open Source Matters
Webimagery - http://www.webimagery.net/ - Professional Consulting Services
JXtended - http://www.jxtended.com/ - Free and Commercial Joomla! Extensions


Top
 Profile  
 
PostPosted: Fri Dec 16, 2005 8:36 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Sep 07, 2005 10:18 pm
Posts: 617
Location: London
Very well put, thanks. 8)

_________________
Check out the 'bad toilet' online !


Top
 Profile  
 
PostPosted: Mon Dec 19, 2005 11:38 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Sep 07, 2005 10:18 pm
Posts: 617
Location: London
RobS wrote:
In your first question, are you asking how to pass an argument to a function?  Or something else?

As for the second question.

require_once ( $mainframe->getPath( 'front_html' ) );

Is saying that this file, is trying to include another file, which is the nave of the component.html.php.  front_html is basically an internal variable constant referring to the components .html.php file, which is used normally to do the actual html presentation. 


Im getting the following error when trying to use the above instead of just including (in this case) "display.html.php";
Code:
Fatal error: Call to a member function getPath() on a non-object in C:\Uniform3_1_1s\www\landedAt\components\com_journal\journal.php on line 113


the object doesnt exist, ive tried the line global $mainframe which doesnt work.
thanks for any help

_________________
Check out the 'bad toilet' online !


Top
 Profile  
 
PostPosted: Mon Dec 19, 2005 11:41 am 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Wed Aug 17, 2005 10:12 pm
Posts: 1827
Location: Germany-Bad Abbach
mojito wrote:
RobS wrote:
In your first question, are you asking how to pass an argument to a function?  Or something else?

As for the second question.

require_once ( $mainframe->getPath( 'front_html' ) );

Is saying that this file, is trying to include another file, which is the nave of the component.html.php.  front_html is basically an internal variable constant referring to the components .html.php file, which is used normally to do the actual html presentation. 


Im getting the following error when trying to use the above instead of just including (in this case) "display.html.php";
Code:
Fatal error: Call to a member function getPath() on a non-object in C:\Uniform3_1_1s\www\landedAt\components\com_journal\journal.php on line 113


the object doesnt exist, ive tried the line global $mainframe which doesnt work.
thanks for any help


Your component is named com_journal so the display.html.php has to renamed to journal.html.php

_________________
The "Humor, Fun and Games" forum has  more than 2500 Posts, so why not build a "Humor, Fun and Games Working" Group?
.....
Malicious tongues say we have this WG right from the start, they call it core team :D


Top
 Profile  
 
PostPosted: Mon Dec 19, 2005 12:00 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Sep 07, 2005 10:18 pm
Posts: 617
Location: London
But it is a separate template from journal.html.php. I want to have many templates for this component. Does this mean that I just should use

require(display.html.php);

is there anything wrong with that cause this works.

thanks

_________________
Check out the 'bad toilet' online !


Top
 Profile  
 
PostPosted: Mon Dec 19, 2005 8:34 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Tue Aug 23, 2005 4:27 am
Posts: 85
Ian (or anyone else),

Is there a fairly straight forward way, or some class already defined in Joomla that I can use to dump my $_POST vars into an array and use sessions to pass them along in the component?

that way I don't have to rely passing everything along via the URL?


Top
 Profile  
 
PostPosted: Mon Dec 19, 2005 8:38 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Wed Aug 17, 2005 10:12 pm
Posts: 1827
Location: Germany-Bad Abbach
mojito wrote:
But it is a separate template from journal.html.php. I want to have many templates for this component. Does this mean that I just should use

require(display.html.php);

is there anything wrong with that cause this works.

thanks



The getPath directly by using with front_html, class etc is limit to only this files, for other you need to use require.

_________________
The "Humor, Fun and Games" forum has  more than 2500 Posts, so why not build a "Humor, Fun and Games Working" Group?
.....
Malicious tongues say we have this WG right from the start, they call it core team :D


Top
 Profile  
 
PostPosted: Tue Dec 20, 2005 12:22 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Wed Sep 07, 2005 10:18 pm
Posts: 617
Location: London
rontec76 wrote:
Ian (or anyone else),

Is there a fairly straight forward way, or some class already defined in Joomla that I can use to dump my $_POST vars into an array and use sessions to pass them along in the component?

that way I don't have to rely passing everything along via the URL?


I would like to know more on that as well here http://forum.joomla.org/index.php/topic,23929.0.html so we dont go off topic.

_________________
Check out the 'bad toilet' online !


Top
 Profile  
 
PostPosted: Wed Dec 21, 2005 7:06 am 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Tue Aug 23, 2005 4:27 am
Posts: 85
sorry...

somehow in one of late nights i accidentally posted this here...

sorry to be in the wrong topic...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 



Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group