phplib-users Mailing List for PHPLIB (Page 5)
Brought to you by:
nhruby,
richardarcher
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(106) |
Sep
(99) |
Oct
(44) |
Nov
(97) |
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(56) |
Feb
(81) |
Mar
(134) |
Apr
(69) |
May
(106) |
Jun
(122) |
Jul
(98) |
Aug
(52) |
Sep
(184) |
Oct
(219) |
Nov
(102) |
Dec
(106) |
2003 |
Jan
(88) |
Feb
(37) |
Mar
(46) |
Apr
(51) |
May
(30) |
Jun
(17) |
Jul
(45) |
Aug
(19) |
Sep
(5) |
Oct
(4) |
Nov
(12) |
Dec
(7) |
2004 |
Jan
(11) |
Feb
(7) |
Mar
|
Apr
(15) |
May
(17) |
Jun
(13) |
Jul
(5) |
Aug
|
Sep
(8) |
Oct
(6) |
Nov
(21) |
Dec
(13) |
2005 |
Jan
(4) |
Feb
(3) |
Mar
(7) |
Apr
(7) |
May
|
Jun
(11) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
2006 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
(9) |
Nov
|
Dec
(5) |
2007 |
Jan
(15) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
(3) |
Jul
(1) |
Aug
(19) |
Sep
(2) |
Oct
|
Nov
|
Dec
(6) |
2009 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
From: <an...@sp...> - 2005-11-08 17:02:10
|
Hello Andrew, Thanks a lot for the reply so I know that I am not alone :) >What exactly are you doing that generates the URLs you describe? I use it in a navigationbar, so if I click on one item and than on the next item the url ever "knows" where I was before. It's ok, but I don't like it, it looks so ugly. I thought there was something that looks into the querystring and than deletes doubles and gives the cleaned querystring back, but maybe I am wrong. There will come a day for urlbeauty. :) >I think most people who are still using phplib concluded that the query >string session fall back was too insecure for most uses and configured >to allow only cookies for session propagation. I know but there are also a lot of people who don't allow cookies for whatever. So I want to use the feature, but as described above its just for the urlbeauty. bye Andreas |
From: <an...@sp...> - 2005-11-07 22:24:48
|
Dear List, sorry for the previous posting (stupid webmailer) :(. I noticed that the sourceforge site ist down. Maybe someone is able to fix this. But my real problem in the moment is, that I want to use the $sess->url() functionality, for a new project, and I have the feeling, that something is going wrong. My problem is that: every new variable will be appended in the end of the url. So that I have urls like: http://localhost/?doc=e&doc=f&doc=g ..... and so on. I think this behaviour is new, right now I can't remember that it was so in my older phplib projects. Does anybody have an idea how to solve this? I use phplib 7.4. Thanks in advance Andreas |
From: <an...@sp...> - 2005-11-07 22:13:31
|
From: <mk...@mc...> - 2005-07-12 07:15:10
|
Hi Fabrizio, > Is there still someone around here? :-) yes! We are!!! Silently... :) Good to see that there is still life on this list!!! It's probably because phplib just WORKS! ;) (Although I have to admit that I had quite a few problems in the past with cookies and session handling...) But recently I switched to PHP 4.3.9 & 4.3.10 on apache2 and surprisingly both seem to work without problems including php4 sessions, except a PEAR configuration problem. Regards, Marko |
From: Layne W. <la...@dr...> - 2005-07-04 18:44:49
|
> how can a set on a page more that one permission? The trick is to set up your permission levels so that multiple levels can meet the different combinations of access requirements that you need throughout your project. If you haven't yet, read the relavent section of the PHPLib manual <http://www.sanisoft.com/phplib/manual/perm.php>. It is possible that you may need more complexity than exists in PHPLib's permissions class - I have created a few different perm classes for various projects that use PHPLib's API, but have different internals as needed. --=20 Layne Weathers |
From: <pte...@te...> - 2005-07-04 18:01:13
|
And.... If you cannot avoid sending your headers first, you could consider using PHP functions ob_start() end ob_end_flush() Cheers, Peter 0At 04-07-2005 16:55, Fabrizio Ermini wrote: >*I know that is because of fuction session_start() on file session4.inc, >but i don't know what to do to solve this problem. >Does anybody have idea of what is happening? > >----- > >Yes, you're sending to output something before the call to session_start. >You must be sure that there is nothing that gets sent to the browser (not >even white space) before the function call. > >HTH, bye >Fabrizio > > > > > > >------------------------------------------------------- >SF.Net email is sponsored by: Discover Easy Linux Migration Strategies >from IBM. Find simple to follow Roadmaps, straightforward articles, >informative Webcasts and more! Get everything you need to get up to >speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click >_______________________________________________ >Phplib-users mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: <ima...@ya...> - 2005-07-04 17:02:35
|
how can a set on a page more that one permission? thanks Marylly **Mya** _______________________________________________________ Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/ |
From: Fabrizio E. <fab...@sy...> - 2005-07-04 14:58:39
|
*I know that is because of fuction session_start() on file session4.inc, but i don't know what to do to solve this problem. Does anybody have idea of what is happening? ----- Yes, you're sending to output something before the call to session_start. You must be sure that there is nothing that gets sent to the browser (not even white space) before the function call. HTH, bye Fabrizio |
From: <ima...@ya...> - 2005-07-04 14:48:27
|
Guys, I'm having problems! I'm using PHPLIB library authentication. I'm adding to each page the following: page_open(array("sess" => "My_Session", "auth" => "My_Auth", "perm" => "My_Perm", "user" => "My_User")); and in the end: page_close(); but it's warning this message: *Warning*: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/apache2-default/cad_usuario.php:2) in */usr/share/php4/php/session4.inc* on line *171 *I know that is because of fuction session_start() on file session4.inc, but i don't know what to do to solve this problem. Does anybody have idea of what is happening? thanks Marylly **Mya** _______________________________________________________ Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/ |
From: Layne W. <la...@dr...> - 2005-07-01 00:33:47
|
> I using the PHPLIB Library to authenticate my user on my pages, but > I'm having problems, because on my page a create a frame, and thereis > the menu with links to others pages. the problems is that everytime > that a click on a link and open the page, appears the login screen. > What can I do to keep my user logged? is this happening because of > the frames? Yes, the frames are causing this. If I recall correctly, the way to prevent this is to only use the page_close() function in one of the frames and none of the others - you'll need to use page_open() in all the pages to get your session and auth info. --=20 Layne Weathers |
From: <ima...@ya...> - 2005-06-30 19:14:46
|
Hello guys! I using the PHPLIB Library to authenticate my user on my pages, but I'm having problems, because on my page a create a frame, and thereis the menu with links to others pages. the problems is that everytime that a click on a link and open the page, appears the login screen. What can I do to keep my user logged? is this happening because of the frames? thank Marylly **Mya** _______________________________________________________ Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/ |
From: Fabrizio E. <fab...@sy...> - 2005-06-27 15:12:04
|
My understanding of the issue is that thread safety is only a concern with PHP's modules, not any code that may be written in PHP. --- So was mine, but you know, when you're out of clues, you start clutching at straws... ---- Well, as you mentioned, your problem is strange enough that I don't have any good idea what would be causing it. Are you using the PHP3-compatible session class for PHPlib pretty much as-is, or have you modified it somehow? If you're using the User class, same question. The problem you describe would have to be in one of those two areas--you might want to make sure that your class isn't getting confused with user data and session data, since they're both stored in the same table by default. ---- No, I'm using only standard old-style session code, with "multi-record" session (but every time I checked there wasn't any session data spawning more than one record). And i use also auth (still "vanilla" phplib code) and sometimes perm (this is a custom made version). ---- Upgrading to session4 may help you--and it may not. But it's something to try. If you can send more details about what exactly is going on (maybe you can add some debugging code to your scripts that prints messages to a log or something), then I might be able to give a better answer. ----- It's really hard to figure what to log and/or debug. There are 2 incident, in different installations, that I've witnessed in person: 1) in an application I used session to store the values users submit in a complex input form (so the application "remembers" them each time they have to input data again). At one time a user went to the form and found default values that was clearly inserted by another user. No warnings, no errors, looking in auth_Sessions table and in apache logs I didn't find any clue. 2) in another application i've put a "status" line at the end of every page that echoes $auth->auth["uname"]. I received a call from an user that complained to have wrong permissions, so I asked him to read what was written in the status line: well, it was the name of a different user, that at that moment was logged in and working from a different client! This REALLY sent me shivers thru my back. Note that first user's PC is not used by the second one, and that first user does not know second user password. So this was not a failed login for sure. I asked the user to logoff and to login again, no problems, apparently all worked correctly again. Some other info: I use only cookie for session propagation (i've disabled get mode, no fallback). In case 2) there was a proxy in between both users and the servers. In case 1) surely they were connecting via different network routes. I'm going to try swapping to session4 code, to see if something changes. Thank you again for your feedback! PS: please excuse me for the bad quoting form. Sadly i'm forced to use a braindead mail client. |
From: Nathaniel P. <np...@te...> - 2005-06-27 14:12:20
|
Fabrizio Ermini wrote: >>Although I have no idea what's causing the problem (and Apache versions >>/shouldn't/ have anything to do with it) >> >> > >First of all, glad to read you again, Nathaniel. It's been years since the >last time :-) > > Heh, thanks. ;) >What was making me think was the old argument stating that using PHP4 with >Apache 2.0 was a bad idea. >There has been for a long time (I don't know if it's still there) an >"official" statement on PHP site that warned aginst using php 4 on Apache 2 >in a production environment. >I can also submit this link reporting a comment by Rasmus about this: >http://apache.slashdot.org/comments.pl?sid=101407&cid=8644732 > > As long as you're using PHP in a 'prefork' MPM environment (as the post you quoted suggests) then you shouldn't have any real problems. I've been running PHP on Apache 2 for quite a while and it hasn't given me problems, though I admit, I've always used Session4 for sessions of late, so I haven't tested Session '3' on apache 2. >The problem I'm experimenting it's very random and difficult to diagnose, >so I was starting to think it could be caused by some part of code that's >not thread safe. > > My understanding of the issue is that thread safety is only a concern with PHP's modules, not any code that may be written in PHP. >>I'd recommend upgrading to >>session4, myself. Provided you didn't alter the existing session API, it >>should be a drop-in replacement. >> >> > >Yep, but would it correct the problem? > > Well, as you mentioned, your problem is strange enough that I don't have any good idea what would be causing it. Are you using the PHP3-compatible session class for PHPlib pretty much as-is, or have you modified it somehow? If you're using the User class, same question. The problem you describe would have to be in one of those two areas--you might want to make sure that your class isn't getting confused with user data and session data, since they're both stored in the same table by default. Upgrading to session4 may help you--and it may not. But it's something to try. If you can send more details about what exactly is going on (maybe you can add some debugging code to your scripts that prints messages to a log or something), then I might be able to give a better answer. Good luck! -- ___________________________ Nathaniel Price |
From: Fabrizio E. <fab...@sy...> - 2005-06-27 13:53:15
|
Greetings, I think there are a still a few people lurking here and I'm sure there are still people using phplib. --- Glad to hear that ;-) --- I haven't run into any problems running phplib-based applications with the old sessioning under Apache 2. I have a couple of systems that are under fairly heavy use and have seen no incidents of session data getting switched as you describe. However, I will look for it more closely, now. --- Hm. Do you use also auth and perm objects? I use all of them. --- As for switching to php4 session support: that didn't work out for me. As I posted to this list back in February, there seems to be a bug in the phplib php4 session code that generates a warning. I don't think that is necessarily a show stopper but, it's not ideal. --- Argh. This is no good news. Any chance you could remember exactly what was the problem? Thanks for your reply, and best regards Fabrizio Ermini |
From: Fabrizio E. <fab...@sy...> - 2005-06-27 13:50:07
|
>Although I have no idea what's causing the problem (and Apache versions >/shouldn't/ have anything to do with it) First of all, glad to read you again, Nathaniel. It's been years since the last time :-) What was making me think was the old argument stating that using PHP4 with Apache 2.0 was a bad idea. There has been for a long time (I don't know if it's still there) an "official" statement on PHP site that warned aginst using php 4 on Apache 2 in a production environment. I can also submit this link reporting a comment by Rasmus about this: http://apache.slashdot.org/comments.pl?sid=101407&cid=8644732 The problem I'm experimenting it's very random and difficult to diagnose, so I was starting to think it could be caused by some part of code that's not thread safe. >I'd recommend upgrading to >session4, myself. Provided you didn't alter the existing session API, it >should be a drop-in replacement. Yep, but would it correct the problem? Bye, Fabrizio |
From: Andrew C. <ph...@ev...> - 2005-06-25 01:33:41
|
Greetings, I think there are a still a few people lurking here and I'm sure there are still people using phplib. I haven't run into any problems running phplib-based applications with the old sessioning under Apache 2. I have a couple of systems that are under fairly heavy use and have seen no incidents of session data getting switched as you describe. However, I will look for it more closely, now. As for switching to php4 session support: that didn't work out for me. As I posted to this list back in February, there seems to be a bug in the phplib php4 session code that generates a warning. I don't think that is necessarily a show stopper but, it's not ideal. I was going to have a look and see if I could find the problem but, I started running in to some other erratic behavior with one of my apps that was cured immediately by going back to the original sessioning code. There was some discussion here sometime back that concluded that it probably doesn't make much difference which sessioning one uses and that the old sessioning code might even be more efficient. So, I really haven't pursued stomping the bug. Andrew Crawford Fabrizio Ermini wrote: > Hi! > > Is there still someone around here? :-) > > After all these years I continue to use my dear library (with pre-php4 > session). Until lately I didin't have any problem. > But I've a couple installation made under apache 2.0 (that's starting to be > the default on many recent distros) that give me serious trouble: > it appears that erratically it happens some sort of "server side session > hijacking": a user logs in and "inherits" session data of a DIFFERENT user > that it's logged at the same time. This is quite rare, but not so much to > be explained with an MD5 collision! > The subject of this post refers to Apache 2 because that is the fact that > those two installations have in common. I've never seen something like this > in a apache 1.3.x installation. > > Is there anybody that can share come thought on this? Should I upgrade to > session4? Downgrading Apache version seem quite difficult to do. > > Thanks for any input. > Bye! > > Fabrizio Ermini > > > > > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users > |
From: Nathaniel P. <np...@te...> - 2005-06-25 00:08:05
|
Fabrizio Ermini wrote: >Hi! > >Is there still someone around here? :-) > >After all these years I continue to use my dear library (with pre-php4 >session). Until lately I didin't have any problem. >But I've a couple installation made under apache 2.0 (that's starting to be >the default on many recent distros) that give me serious trouble: >it appears that erratically it happens some sort of "server side session >hijacking": a user logs in and "inherits" session data of a DIFFERENT user >that it's logged at the same time. This is quite rare, but not so much to >be explained with an MD5 collision! >The subject of this post refers to Apache 2 because that is the fact that >those two installations have in common. I've never seen something like this >in a apache 1.3.x installation. > >Is there anybody that can share come thought on this? Should I upgrade to >session4? Downgrading Apache version seem quite difficult to do. > > Although I have no idea what's causing the problem (and Apache versions /shouldn't/ have anything to do with it) I'd recommend upgrading to session4, myself. Provided you didn't alter the existing session API, it should be a drop-in replacement. -- ___________________________ Nathaniel Price http://www.tesserportal.net Webmaster |
From: Fabrizio E. <fab...@sy...> - 2005-06-24 14:26:44
|
Hi! Is there still someone around here? :-) After all these years I continue to use my dear library (with pre-php4 session). Until lately I didin't have any problem. But I've a couple installation made under apache 2.0 (that's starting to be the default on many recent distros) that give me serious trouble: it appears that erratically it happens some sort of "server side session hijacking": a user logs in and "inherits" session data of a DIFFERENT user that it's logged at the same time. This is quite rare, but not so much to be explained with an MD5 collision! The subject of this post refers to Apache 2 because that is the fact that those two installations have in common. I've never seen something like this in a apache 1.3.x installation. Is there anybody that can share come thought on this? Should I upgrade to session4? Downgrading Apache version seem quite difficult to do. Thanks for any input. Bye! Fabrizio Ermini |
From: Andrew C. <ph...@ev...> - 2005-06-09 01:38:40
|
Last time I tried to post to the list, it was held for approval (and is still being held). So, I don't know if this will make it to the whole list but, we'll try ... an...@my... wrote: > Below is an example of code of one page : > $aDb = new DB_oi_ct; > $aDb->query("$squery"); > $squery = " INSERT INTO auto_messages > ( message_name, > auto_messages > ) > VALUES > ( '$Message_Name', > '$Message' > )"; I'm not familiar with FastTemplates and I'm not sure this has any bearing on your problem but, shouldn't you be defining the query string ($squery) BEFORE you call the query method of your database object with the variable? As written, won't this section of your script send an empty query to the database since $squery is undefined at the point you call the query method with it? Or am I missing something? Andrew Crawford |
From: Nathaniel P. <np...@te...> - 2005-06-08 21:16:54
|
an...@my... wrote: >Dear list > >Been using PHPLib a few years back and started using it again for a project >since the DB class, auth and sessions are just so easy and effective to use. > > >Im running into a problem however. I have used FastTemplates on my pages and >found that where I have a Insert statement that I try to do with : > >$squery = "INSERT INTO auto_messages(message_name,auto_messages) VALUES >('$Message_Name', '$Message')"; >$aDb = new DB_oi_ct; >$aDb->query("$squery"); > > >...as an example, this statement however always (on all pages where I would >do some insert into the db) in one valid row of data entered and one blank >line (Never just one entry) I thought that it might be fastTemplates and >swithed over to phplib's own template but still got one valid db insert and >one blank insert. > >I have also used a Mailing class to send mail and get the same thing, 2 >emails arrive - one with values and one blank. > >I tried to print the query to see what the query look like and only one >query (correct) displays. Ive enabled phplib debug echo and it also displays >one query? > > >My current environment is : > >Windows XP sp2 >Installed phpdev423 - from firepages.com.au > >I have tried to play with the php.ini settings for track_vars, magic quotes >etc (as per phplib doc) and restarted apache. I still get blank database >inserts and blank emails. > >Also note if I take the template out of the picture and only use the DB >object then everything works fine - then my insert query results in one >entry only with valid values etc? > > Hmm... I can't say that I've ever run into a problem like that. It sounds like the templating system might be causing the query to execute twice, with one of the execution's output being discarded or something. However, I can't really be sure. Since you mentioned that it works fine when you don't use templates, I'd look for the bug there in any case--it sounds like the problem might be in how you've implemented the templates, since you said that the bug occurs both with PHPlib Templates and FastTemplates. Unfortunately, I don't use a templating system on my projects, so I can't offer any more clues as to what might be causing that. -- ___________________________ Nathaniel Price |
From: <an...@my...> - 2005-06-08 19:29:47
|
Dear list Been using PHPLib a few years back and started using it again for a project since the DB class, auth and sessions are just so easy and effective to use. Im running into a problem however. I have used FastTemplates on my pages and found that where I have a Insert statement that I try to do with : $squery = "INSERT INTO auto_messages(message_name,auto_messages) VALUES ('$Message_Name', '$Message')"; $aDb = new DB_oi_ct; $aDb->query("$squery"); ...as an example, this statement however always (on all pages where I would do some insert into the db) in one valid row of data entered and one blank line (Never just one entry) I thought that it might be fastTemplates and swithed over to phplib's own template but still got one valid db insert and one blank insert. I have also used a Mailing class to send mail and get the same thing, 2 emails arrive - one with values and one blank. I tried to print the query to see what the query look like and only one query (correct) displays. Ive enabled phplib debug echo and it also displays one query? My current environment is : Windows XP sp2 Installed phpdev423 - from firepages.com.au I have tried to play with the php.ini settings for track_vars, magic quotes etc (as per phplib doc) and restarted apache. I still get blank database inserts and blank emails. Also note if I take the template out of the picture and only use the DB object then everything works fine - then my insert query results in one entry only with valid values etc? Below is an example of code of one page : <? include_once("./php/prepend.php3"); page_open(array ("sess" => "oi_ct_Session", "auth" => "oi_ct_Challenge_Auth", "perm" => "oi_ct_Perm")); $perm->check("admin"); $auth->login_if($again); if ($auth->auth["uid"] == "nobody") { $relogin = '<A HREF="$sess->purl("$PHP_SELF?again=yes")">Relogin</A>to this page'; } else { $relogin = 'Logged in'; } $aDb = new DB_oi_ct; $aDb->query("$squery"); $squery = " INSERT INTO auto_messages ( message_name, auto_messages ) VALUES ( '$Message_Name', '$Message' )"; $tpl = new FastTemplate("./html/"); $tpl->define(array(main => "template.htm",)); $tpl->assign(array( HEADER => "TEST", BODY_HEADER => "NEW MESSAGE RECORD", TOP_MENU => "MENU", MENU_ITEMS => "", BOTTOM_MENU => "", BOTTOM_ITEMS => "" )); $text = "Updated ..."; $tpl->assign(BODY_TEXT, $text); $tpl->parse(MAIN, "main"); $tpl->FastPrint(MAIN); page_close(); ?> -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.6 - Release Date: 2005/06/08 |
From: Dark <dar...@gm...> - 2005-04-29 18:13:18
|
Why don=B4t you try to use parameters in the function as needed an call the= =20 function as many times as you need passing the apropiate values as=20 parameters? 2005/4/29, Marylly Araujo Silva <ima...@ya...>: >=20 > Like you answered me, I can use the function make_select_list() to make > select box. But how can I make more than one select box if i can't > declare the function more than once? >=20 > I'm wanting to do a pge using the PHPLIB Templates with two select boxes > ,beind one of them depends on the other to generate the option list and > after select the two select boxes will show a list from the database. >=20 > if you didn't understand i can give more details >=20 > please, help me >=20 > thanks any way >=20 > marylly > **Mya** >=20 > Andrew Crawford wrote: >=20 > > Hi Mya, > > > > Are you using PHPLIB's database abstraction? Are you using PHPLIB > > templates? > > > > If the answer to these questions is no, you have a general PHP > > question and should look for another mailing list or forum to get the > > answer. > > > > If the answer to both questions is yes, you should be able to do > > something like this: > > > > function make_select_list($selected) { > > $exampledb =3D new DB_Example; > > $query =3D "SELECT label,value FROM table ORDER BY label"; > > $exampledb->query($query); > > > > // Did we get any results? If not, fail appropriately ... > > > > // Loop template > > $loop_t =3D new Template_Example; > > > > // our mini-template > > $loop_t->set_var("option", "<option > > value=3D\"{value}\"{selected}>{label}</option>\n"); > > > > // put our data into the template > > while ($exampledb->next_record()) { > > $loop_t->set_var(array( > > "label" =3D> $exampledb->f("label"), > > "value" =3D> $exampledb->f("value"), > > "selected" =3D> ((!is_null($selected) and > > ($exampledb->f("value") =3D=3D $selected)) ? " selected" : ""))); > > $loop_t->parse("options", "option", true); > > } > > > > // return the options list > > return $loop_t->get_var("options"); > > } > > > > The returned value will then contain a series of options: > > > > <option value=3D"value1">Label 1</option> > > <option value=3D"value2">Label 2</option> > > ... > > <option value=3D"valuen">Label n</option> > > > > ... and you can put it into your main page template, assigning it to a > > template variable just like anything else. > > > > Template: > > > > <!-- top part of page goes here --> > > <select name=3D"example_select"> > > {option_list} > > </select> > > <!-- bottom part of page goes here --> > > > > > > Code: > > > > // Set selected to appropriate value > > $selected =3D ""; > > > > // Set up your template > > $t =3D new Template; > > $t->set_file('content', 'example_template.ihtml'); > > > > // Generate the option list > > $our_option_list =3D make_select_list($selected); > > > > // Fill in the variables > > $t->set_var('option_list', $our_option_list); > > > > // Output the page > > $t->parse('out', 'content'); > > $t->p('out'); > > > > I hope that helps. > > > > Andrew Crawford > > > > Marylly Araujo Silva wrote: > > > >> hello guys > >> > >> Can I create a select box and create the options using a db query > >> from the database? > >> > >> thanks > >> > >> Marylly > >> **Mya** > > > > >=20 > ------------------------------------------------------- > This SF.Net <http://SF.Net> email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4 great events, = 4 > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=3D20 > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users >=20 --=20 ________________________________ Los sabios tienen las mismas ventajas=20 sobre los ignorantes que los=20 vivos sobre los muertos. Arist=F3teles |
From: Marylly A. S. <ima...@ya...> - 2005-04-29 17:51:49
|
Like you answered me, I can use the function make_select_list() to make select box. But how can I make more than one select box if i can't declare the function more than once? I'm wanting to do a pge using the PHPLIB Templates with two select boxes ,beind one of them depends on the other to generate the option list and after select the two select boxes will show a list from the database. if you didn't understand i can give more details please, help me thanks any way marylly **Mya** Andrew Crawford wrote: > Hi Mya, > > Are you using PHPLIB's database abstraction? Are you using PHPLIB > templates? > > If the answer to these questions is no, you have a general PHP > question and should look for another mailing list or forum to get the > answer. > > If the answer to both questions is yes, you should be able to do > something like this: > > function make_select_list($selected) { > $exampledb = new DB_Example; > $query = "SELECT label,value FROM table ORDER BY label"; > $exampledb->query($query); > > // Did we get any results? If not, fail appropriately ... > > // Loop template > $loop_t = new Template_Example; > > // our mini-template > $loop_t->set_var("option", "<option > value=\"{value}\"{selected}>{label}</option>\n"); > > // put our data into the template > while ($exampledb->next_record()) { > $loop_t->set_var(array( > "label" => $exampledb->f("label"), > "value" => $exampledb->f("value"), > "selected" => ((!is_null($selected) and > ($exampledb->f("value") == $selected)) ? " selected" : ""))); > $loop_t->parse("options", "option", true); > } > > // return the options list > return $loop_t->get_var("options"); > } > > The returned value will then contain a series of options: > > <option value="value1">Label 1</option> > <option value="value2">Label 2</option> > ... > <option value="valuen">Label n</option> > > ... and you can put it into your main page template, assigning it to a > template variable just like anything else. > > Template: > > <!-- top part of page goes here --> > <select name="example_select"> > {option_list} > </select> > <!-- bottom part of page goes here --> > > > Code: > > // Set selected to appropriate value > $selected = ""; > > // Set up your template > $t = new Template; > $t->set_file('content', 'example_template.ihtml'); > > // Generate the option list > $our_option_list = make_select_list($selected); > > // Fill in the variables > $t->set_var('option_list', $our_option_list); > > // Output the page > $t->parse('out', 'content'); > $t->p('out'); > > I hope that helps. > > Andrew Crawford > > Marylly Araujo Silva wrote: > >> hello guys >> >> Can I create a select box and create the options using a db query >> from the database? >> >> thanks >> >> Marylly >> **Mya** > > |
From: Marylly A. S. <ima...@ya...> - 2005-04-26 17:31:05
|
Andrew, I've been using the PHPLIB's database abstraction I guess. But I doesn't matter if it is PHPLIB's data abstraction or not. I hope a combobox which works. I will try the first example that you have writen and later I write the results. see ya Marylly **Mya** Andrew Crawford wrote: > Hi Mya, > > Are you using PHPLIB's database abstraction? Are you using PHPLIB > templates? > > If the answer to these questions is no, you have a general PHP > question and should look for another mailing list or forum to get the > answer. > > If the answer to both questions is yes, you should be able to do > something like this: > > function make_select_list($selected) { > $exampledb = new DB_Example; > $query = "SELECT label,value FROM table ORDER BY label"; > $exampledb->query($query); > > // Did we get any results? If not, fail appropriately ... > > // Loop template > $loop_t = new Template_Example; > > // our mini-template > $loop_t->set_var("option", "<option > value=\"{value}\"{selected}>{label}</option>\n"); > > // put our data into the template > while ($exampledb->next_record()) { > $loop_t->set_var(array( > "label" => $exampledb->f("label"), > "value" => $exampledb->f("value"), > "selected" => ((!is_null($selected) and > ($exampledb->f("value") == $selected)) ? " selected" : ""))); > $loop_t->parse("options", "option", true); > } > > // return the options list > return $loop_t->get_var("options"); > } > > The returned value will then contain a series of options: > > <option value="value1">Label 1</option> > <option value="value2">Label 2</option> > ... > <option value="valuen">Label n</option> > > ... and you can put it into your main page template, assigning it to a > template variable just like anything else. > > Template: > > <!-- top part of page goes here --> > <select name="example_select"> > {option_list} > </select> > <!-- bottom part of page goes here --> > > > Code: > > // Set selected to appropriate value > $selected = ""; > > // Set up your template > $t = new Template; > $t->set_file('content', 'example_template.ihtml'); > > // Generate the option list > $our_option_list = make_select_list($selected); > > // Fill in the variables > $t->set_var('option_list', $our_option_list); > > // Output the page > $t->parse('out', 'content'); > $t->p('out'); > > I hope that helps. > > Andrew Crawford > > Marylly Araujo Silva wrote: > >> hello guys >> >> Can I create a select box and create the options using a db query >> from the database? >> >> thanks >> >> Marylly >> **Mya** > > |
From: Marylly A. S. <ima...@ya...> - 2005-04-25 21:15:14
|
hello guys Can I create a select box and create the options using a db query from the database? thanks Marylly **Mya** ______________________________________________________________________ Yahoo! Mail - agora com 100MB de espaço, anti-spam e antivírus grátis! http://br.info.mail.yahoo.com/ |