phplib-users Mailing List for PHPLIB (Page 78)
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: nathan r. h. <na...@ds...> - 2002-01-06 15:03:35
|
On Sun, 6 Jan 2002, Tarique Sani <ta...@sa...> wrote: > On 6 Jan 2002, Huib Kleinhout wrote: > Hi Huib, > > Did you check the CVS version? > > Else please file a bug report > Bug was filed, error occurs in current cvs.. will be fixed in pre2 :) Huib, Thank you for this bug report! -n -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- nathan hruby / digital statement na...@ds... http://www.dstatement.com/ Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: Tarique S. <ta...@sa...> - 2002-01-06 14:04:02
|
On 6 Jan 2002, Huib Kleinhout wrote: Hi Huib, Did you check the CVS version? Else please file a bug report :-) Tarique > Hi, > To anyone having cvs access: > There are some easy to fix bugs in session.inc -- ========================================================== PHP Applications for E-Biz : http://www.sanisoft.com The Ultimate Ghazal Lexicon: http://www.aaina-e-ghazal.com ========================================================== |
From: Huib K. <hu...@st...> - 2002-01-06 13:49:31
|
Hi, To anyone having cvs access: There are some easy to fix bugs in session.inc When the same kind of header is send more than once (for example 'Cache-control') The second argument of the php function: int header (string string [, bool replace]) should be used (it should be 'false'). for example: default: header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache"); header("Cache-Control: post-check=0, pre-check=0"); header("Pragma: no-cache"); should be replaced with: default: header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); At this moment only the header "Cache-Control: post-check=0, pre-check=0" is send. This header is IE-only (violates rfc2616 and even doesn't work on most versions of IE because of the 125362 bugs in the IE caching system) thanks! Huib |
From: nathan r. h. <na...@ds...> - 2002-01-05 19:58:16
|
Hey, phplib-7.4-pre1 is in the queue, waiting on the friggin' upload server to accept a connection so I can put the tarball into the file release system. I think they (the sf.net folks) mey be doing Site Mainenence, but I can't tell. Anyway, expect a new release sometime soon after the uplaods server starts working again... A formal annoucnement and Freshmeat posting will be forthcoming. This release is being tagged as PHPLIB_7_4_PRE1 in the "php-lib-stable" cvs module located at cvs.phplib.sf.net:/cvsroot/phplib. Those users whose double mocha latte induced barins are itiching for a little extra pain this lovely Saturday afternoon, may get started now via CVS :) -n -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- nathan hruby / digital statement na...@ds... http://www.dstatement.com/ Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: John L. <jo...@li...> - 2002-01-04 02:35:53
|
I'm trying to make my phplib 7.2d version register_globals="off" compliant. Can anyone point me in the right direction to accomplish this. I'm assuming the topic has been discussed here before and I'm hoping it is a relatively simple affair for a number of programmers on this list. Thanks /* J. Lewis lamp/php developer livingpages.com */ |
From: Layne W. <la...@of...> - 2002-01-02 19:26:12
|
> >> How, using the current template.inc, can you repetitively use the > >> same template, expanded with different values, into other > >> templates? > >> > >> Example: > >> > >> <!-- BEGIN top --> (item) <!-- END top --> > >> > >> <!-- BEGIN item --> (links) <!-- END item --> > >> > >> <!-- BEGIN block --> (links) <!-- END block --> > >> > >> <!-- BEGIN links --> {link} <!-- END links --> > >> > >> And I want "top" containing multiple instances of "item" and > >> "block", with each of those sub-blocks containing a different > >> "links". The obvious approach doesn't work because the first > >> time I parse "links" to then build a block or item the template > >> is lost so I can't come back later with a new value for "link" > >> and gen a new value to later shove in a new block or item. > > > Although you are parseing the "links" block into several places, > > you need to name the target variables separately ({some_links}, > > {some_other_links}, etc). > > That's not the problem. > > The core of the problem is that set_block() replaces the instance of > the template in the file with {$name}. The core of the problem is > that is replaces $parent with {$name}, where $parent is the name of > the template (eg "links" above), and so can't be varied on a > per-call basis. You said that the block 'top' needs to contain multiple 'item's and multiple 'block's. I am leaving out the 'top' block because you didn't say anything about looping through multiple tops - if you need to do that it works the same way. ##### template.html ##### <!-- this was a block named top --> <!-- BEGIN item --> <!-- BEGIN links --> {link} <!-- END links --> <!-- END item --> <!-- BEGIN block --> (block_links) <!-- END block --> <!-- this was a block named top --> ###### page.php ###### $t = new Template; $db = $db2 = new DB_Whatever; $t->set_file("file", "template.html"); $t->set_block("file", "item", "items"); $t->set_block("item", "links", "item_links"); $t->set_block("file", "block", "blocks"); // dummy queries - you've got your data retrieval figured out // get all of the 'item's $db->query("select item from some_table"); while($db->next_record()) { // get all of the 'item' links $db2->query(sprintf("select link from item_links_table where item = '%s'", $db->f("item"))); while($db2->next_record()) { $t->set_var($db2->Record); $t->parse("item_links", "links", true); } $t->parse("items", "item", true); $t->set_var("item_links", ""); } // now get all of the 'block's $db->query("select block from some_table"); while($db->next_record()) { // get all of the 'block' links $db2->query(sprintf("select link from block_links_table where block = '%s'", $db->f("block"))); while($db2->next_record()) { $t->set_var($db2->Record); $t->parse("block_links", "links", true); } $t->parse("blocks", "block", true); $t->set_var("block_links", ""); } $t->pparse("file"); |
From: J C L. <cl...@ka...> - 2002-01-02 18:20:12
|
On Mon, 31 Dec 2001 09:10:20 -0600 Layne Weathers <la...@of...> wrote: >> How, using the current template.inc, can you repetitively use the >> same template, expanded with different values, into other >> templates? >> >> Example: >> >> <!-- BEGIN top --> (item) <!-- END top --> >> >> <!-- BEGIN item --> (links) <!-- END item --> >> >> <!-- BEGIN block --> (links) <!-- END block --> >> >> <!-- BEGIN links --> {link} <!-- END links --> >> >> And I want "top" containing multiple instances of "item" and >> "block", with each of those sub-blocks containing a different >> "links". The obvious approach doesn't work because the first >> time I parse "links" to then build a block or item the template >> is lost so I can't come back later with a new value for "link" >> and gen a new value to later shove in a new block or item. > Although you are parseing the "links" block into several places, > you need to name the target variables separately ({some_links}, > {some_other_links}, etc). That's not the problem. The core of the problem is that set_block() replaces the instance of the template in the file with {$name}. The core of the problem is that is replaces $parent with {$name}, where $parent is the name of the template (eg "links" above), and so can't be varied on a per-call basis. -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. cl...@ka... He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. |
From: Herouth M. <he...@it...> - 2002-01-01 07:30:17
|
On 2001 December? 31 ,Monday 17:30, Layne Weathers wrote: > > I think you might want to try instantiating your db class here > instead of the image class you are creating. Try (with your class > name): > > $img->db = new DB_Example; > In addition, since this is the class definition, don't you mean $this->db? What is $img? Herouth |
From: Richard A. <rh...@ju...> - 2002-01-01 06:00:10
|
At 9:12 AM +0530 31/12/01, Dr Tarique Sani <ta...@na...> wrote: >If the support is *turn off-able" and by default it is *off* then I guess >we should have it in the main template.inc it self. I disagree. There are three or four such patches in the old netuse list archives. Each time they were proposed they were rejected. Since PHP is a scripting language, the logic should be coded in PHP, not in a new template language. ...R. |
From: nathan r. h. <na...@ds...> - 2001-12-31 21:38:33
|
On Mon, 31 Dec 2001, Frank Bax wrote: > Try: > function Image() { > global $GLOBALS; > $ID=$GLOBALS[ID]; > > Umm.. $GLOBALS[] is availible everywhere, isn't it? It's an alternative to the 'global' keyword? I just asked in openprojects:#php and someone remined me that paramters need to be static (eg: function foo($bar='something')) so Umm I did steer you wrong at first. Sorry. The class looks like it should work as you have it though.. er.. what's the calling script look like? I assume you're doing something like: include('/path/to/image.class'); $img = new Image; ? Right ;-) (Hey, it take me 10 minutes to figure out someone unpluged my computer :) So a few questions: - What php version are you using? - Where exactly does $ID come from? -n.. the nice thing about New Years Eve is that I can start drinking at 4 in the afternoon and not feel guility. Wheeeeeee! ps.. I'm going to make a side trip into proper coding styles becasue I see a lot of this (Ajay is guilty of this too, hence the parser warnings): PHP Interperts the following three statements differently: $array[foo] // foo is assumed to be a constant $array["foo"] // "foo" is scanned for variables to substitute before // executing the statsment $array['foo'] // foo is taken as a literal text string mixing and matching these just don't work, you need to be aware of what you're using. In your script you use $GLOBALS[ID] which makes php think that it should look for a constant named "ID" to use for substituion in the array, and fails. My expernice is that php normally makes the right choice and falls back to a varaible, but can give it the incorrect scope, hence your problems.. It pays to be extra pedantic about variable scope and importation becasue this is where most security issues come from, not to mention by not specficly telling php what kind ofvariable you're using, icky and hard to trace bugs (like this one) can be introduced. -n > >In anycase, the whole file now looks like this: > > > ><?php > >error_reporting(E_ALL); > >require('config.php3'); > > > >if ($debug && $HTTP_GET_VARS[breakme]) { > > echo "I'm outputing something to break the headers.<br>\n"; > > echo "This will allow me to see what exactly I'm sending.<br>\n"; > > echo "Including errors :)<br>\n"; > >} > > > >class Image { > > var $db; > > function Image() { > > $ID=$GLOBALS[ID]; > > $this->db = new proDB; > > echo "this isn't working"; > > $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; > > echo $this->db->nf(); > > $this->db->query($sql); > > while ($this->db->next_record()) { > > // Header("Content-type: image/jpeg"); > > print $this->db->Record['photo']; > > } > > } > >} > >?> > > -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- nathan hruby / digital statement na...@ds... http://www.dstatement.com/ Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: Mike G. <mi...@op...> - 2001-12-31 21:08:25
|
Hi Frank, Frank Bax wrote: > Try: > function Image() { > global $GLOBALS; > $ID=$GLOBALS[ID]; Nope this didn't work either.. I can't get this class to output anything.. I must be completely missing something pretty big... I've now got these two lines in the class (which should be putting out something), which don't give me an error and aren't providing me with a value: echo "this isn't working $ID"; echo $this->db->nf(); Mike ps.. Maybe I just need to put this project off till the new year - ha! btw. Happy New Year Everyone! -- Mike Gifford, OpenConcept Consulting, http://www.openconcept.ca Supporting progressive organizations in online campaigns and tools. Feature: Women's Learning Partnership http://learningpartnership.org Truth is that which confirms what we already believe. Northrop Frye |
From: Frank B. <fb...@sy...> - 2001-12-31 20:52:46
|
Try: function Image() { global $GLOBALS; $ID=$GLOBALS[ID]; At 03:51 PM 12/31/01 -0500, Mike Gifford wrote: >Hey Nathan, > >nathan r. hruby wrote: > >>>OK.. My present code looks like this: >>>require('config.php3'); >>>class Image { >>> var $db; >>> function Image($ID='$GLOBALS[ID]') { >> No quotes in the above, it's not working cause $ID is being set to the >> string "$GLOBALS[ID]" and not the actual value of the global $ID (as a >> side note, this happen becasue you're using single quotes which casue >> literal strings, double quotes would have meant that the string would have >> been scanned for variable substituion and it would have been ok, but you >> would have paid a small performance penalty for that substitution. This >> is where knowing everything about your varibles comes in handy.) > > >I tried a stack of different options on this, but these gave me parse >errors: > $ID=$GLOBALS[ID] > $ID="$GLOBALS[ID]" > >and these didn't (they gave me identical - but bad results): > $ID='$GLOBALS[ID]' > $ID=48 > >As did this actually: > >require('config.php3'); >class Image { > var $db; > function Image() { > $ID=$GLOBALS[ID]; > echo "ID $ID"; > $this->db = new proDB; > $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; > $this->db->query($sql); > while ($this->db->next_record()) { > Header("Content-type: image/jpeg"); > print $this->db->Record['photo']; > } > } >} > >Although this displays properly outside of the class... > $ID=$GLOBALS[ID]; > echo "ID $ID"; > >result is: > ID 48 > > >>>I just want to clarify though.. in the example you gave ($this->db = >>>new nameOfdbClass;), if I was trying to add this to phpSlash 6.2 >>>nameOfdbClass; would be DB_Sql (or would it be slashDB? >> if all youre tables are in the same databse as the phpslash stuff, then >> slashDB, else you'll need to make a new subclass of DB_Sql. > > >Hmm.. That is essentially what I'm doing... > >Some folks on this list may remember me asking about/talking up a online >bibliography 6 months or so ago.. It's mostly working now and sitting >here (still in draft mode): > http://www.openconcept.ca/WLP/biblio/categories.php3 > >I'm presently working up the portfolio side (harder to explain), but >this is what I need the images for... In anycase, it's all based on the >6.2 code of phpSlash.. > > >>>Both seem to produce the same result for me.. I even tried commenting >>>out the header line (Header("Content-type: image/jpeg");) to see if that >>>would just echo the raw jpg data.. It didn't.. So something's goofing >>>up... >> Make sure you're not outputing anything before that header() call. I bet >> there's an error creeping in (probably from using the wrong db class) >> that's casuing it. For something liek what you're doing I like to add a >> construct like this to the top of my code: > >> if ($debug && $HTTP_GET_VARS[breakme]) { >> echo "I'm outputing something to break the headers.<br>\n"; >> echo "This will allow me to see what exactly I'm sending.<br>\n"; >> echo "Including errors :)<br>\n"; >> } > > >This is usefull.. That way it is easy to make/break code.. >http://localhost/WLP/profiles/image.php3?ID=48&breakme=yes > > > >However, I can't seem to get any output from within the class.. > >Putting this in the function and commenting out the header doesn't >output anything.. > echo "this isn't working"; > >The URL above does, but.. that isn't managing stuff within the code.. > > >> Also, check to make sure (for debug pruposes) error_reporting is set to >> E_ALL. And FWIW, I'd do a $this->db->nf() and make sure the returned >> valus is 1 and if it isn't sending a "not availible" jpeg to the >> browser before entering the while() loop. This ensures that if the script >> freaks out and can't find a image in the databse, something is returned to >> the user indicating so :) > > >I've got a couple references of phpSlash 6.2 ending Variable.class with: >}; /* end of Variable.class */ > > >and not the ?> which would be standard.. I've never seen a php file >ended like that before... > >In anycase, the whole file now looks like this: > ><?php >error_reporting(E_ALL); >require('config.php3'); > >if ($debug && $HTTP_GET_VARS[breakme]) { > echo "I'm outputing something to break the headers.<br>\n"; > echo "This will allow me to see what exactly I'm sending.<br>\n"; > echo "Including errors :)<br>\n"; >} > >class Image { > var $db; > function Image() { > $ID=$GLOBALS[ID]; > $this->db = new proDB; > echo "this isn't working"; > $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; > echo $this->db->nf(); > $this->db->query($sql); > while ($this->db->next_record()) { > // Header("Content-type: image/jpeg"); > print $this->db->Record['photo']; > } > } >} >?> > >And results in the following: > >Warning: Undefined variable: sitename in >/usr/local/web/WLP/profiles/config.php3 on line 191 > >Warning: Use of undefined constant rootdir - assumed 'rootdir' in >/usr/local/web/WLP/profiles/Variable.class on line 23 > >Warning: Use of undefined constant basedir - assumed 'basedir' in >/usr/local/web/WLP/profiles/Variable.class on line 24 > >Warning: Use of undefined constant listvariable - assumed 'listvariable' >in /usr/local/web/WLP/profiles/Variable.class on line 33 > >Warning: Use of undefined constant newvariable - assumed 'newvariable' >in /usr/local/web/WLP/profiles/Variable.class on line 34 > >Warning: Use of undefined constant value - assumed 'value' in >/usr/local/web/WLP/profiles/Variable.class on line 55 > >Warning: Undefined variable: siteowner in >/usr/local/web/WLP/profiles/config.php3 on line 192 > >Warning: Use of undefined constant value - assumed 'value' in >/usr/local/web/WLP/profiles/Variable.class on line 55 > >Warning: Undefined variable: xsitename in >/usr/local/web/WLP/profiles/config.php3 on line 193 > >Warning: Use of undefined constant value - assumed 'value' in >/usr/local/web/WLP/profiles/Variable.class on line 55 > >Warning: Use of undefined constant breakme - assumed 'breakme' in >/usr/local/web/WLP/profiles/image.php3 on line 5 > >Warning: Undefined index: breakme in >/usr/local/web/WLP/profiles/image.php3 on line 5 > >Which shouldn't be affecting things when the errors are turned off.. >Those should be pretty innocent.. > >Mike >-- >Mike Gifford, OpenConcept Consulting, http://www.openconcept.ca >Supporting progressive organizations in online campaigns and tools. >Feature: Women's Learning Partnership http://learningpartnership.org >Truth is that which confirms what we already believe. Northrop Frye > > >_______________________________________________ >Phplib-users mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phplib-users > |
From: Mike G. <mi...@op...> - 2001-12-31 20:47:27
|
Hey Nathan, nathan r. hruby wrote: >>OK.. My present code looks like this: >>require('config.php3'); >>class Image { >> var $db; >> function Image($ID='$GLOBALS[ID]') { > No quotes in the above, it's not working cause $ID is being set to the > string "$GLOBALS[ID]" and not the actual value of the global $ID (as a > side note, this happen becasue you're using single quotes which casue > literal strings, double quotes would have meant that the string would have > been scanned for variable substituion and it would have been ok, but you > would have paid a small performance penalty for that substitution. This > is where knowing everything about your varibles comes in handy.) I tried a stack of different options on this, but these gave me parse errors: $ID=$GLOBALS[ID] $ID="$GLOBALS[ID]" and these didn't (they gave me identical - but bad results): $ID='$GLOBALS[ID]' $ID=48 As did this actually: require('config.php3'); class Image { var $db; function Image() { $ID=$GLOBALS[ID]; echo "ID $ID"; $this->db = new proDB; $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; $this->db->query($sql); while ($this->db->next_record()) { Header("Content-type: image/jpeg"); print $this->db->Record['photo']; } } } Although this displays properly outside of the class... $ID=$GLOBALS[ID]; echo "ID $ID"; result is: ID 48 >>I just want to clarify though.. in the example you gave ($this->db = >>new nameOfdbClass;), if I was trying to add this to phpSlash 6.2 >>nameOfdbClass; would be DB_Sql (or would it be slashDB? > if all youre tables are in the same databse as the phpslash stuff, then > slashDB, else you'll need to make a new subclass of DB_Sql. Hmm.. That is essentially what I'm doing... Some folks on this list may remember me asking about/talking up a online bibliography 6 months or so ago.. It's mostly working now and sitting here (still in draft mode): http://www.openconcept.ca/WLP/biblio/categories.php3 I'm presently working up the portfolio side (harder to explain), but this is what I need the images for... In anycase, it's all based on the 6.2 code of phpSlash.. >>Both seem to produce the same result for me.. I even tried commenting >>out the header line (Header("Content-type: image/jpeg");) to see if that >>would just echo the raw jpg data.. It didn't.. So something's goofing >>up... > Make sure you're not outputing anything before that header() call. I bet > there's an error creeping in (probably from using the wrong db class) > that's casuing it. For something liek what you're doing I like to add a > construct like this to the top of my code: > if ($debug && $HTTP_GET_VARS[breakme]) { > echo "I'm outputing something to break the headers.<br>\n"; > echo "This will allow me to see what exactly I'm sending.<br>\n"; > echo "Including errors :)<br>\n"; > } This is usefull.. That way it is easy to make/break code.. http://localhost/WLP/profiles/image.php3?ID=48&breakme=yes However, I can't seem to get any output from within the class.. Putting this in the function and commenting out the header doesn't output anything.. echo "this isn't working"; The URL above does, but.. that isn't managing stuff within the code.. > Also, check to make sure (for debug pruposes) error_reporting is set to > E_ALL. And FWIW, I'd do a $this->db->nf() and make sure the returned > valus is 1 and if it isn't sending a "not availible" jpeg to the > browser before entering the while() loop. This ensures that if the script > freaks out and can't find a image in the databse, something is returned to > the user indicating so :) I've got a couple references of phpSlash 6.2 ending Variable.class with: }; /* end of Variable.class */ and not the ?> which would be standard.. I've never seen a php file ended like that before... In anycase, the whole file now looks like this: <?php error_reporting(E_ALL); require('config.php3'); if ($debug && $HTTP_GET_VARS[breakme]) { echo "I'm outputing something to break the headers.<br>\n"; echo "This will allow me to see what exactly I'm sending.<br>\n"; echo "Including errors :)<br>\n"; } class Image { var $db; function Image() { $ID=$GLOBALS[ID]; $this->db = new proDB; echo "this isn't working"; $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; echo $this->db->nf(); $this->db->query($sql); while ($this->db->next_record()) { // Header("Content-type: image/jpeg"); print $this->db->Record['photo']; } } } ?> And results in the following: Warning: Undefined variable: sitename in /usr/local/web/WLP/profiles/config.php3 on line 191 Warning: Use of undefined constant rootdir - assumed 'rootdir' in /usr/local/web/WLP/profiles/Variable.class on line 23 Warning: Use of undefined constant basedir - assumed 'basedir' in /usr/local/web/WLP/profiles/Variable.class on line 24 Warning: Use of undefined constant listvariable - assumed 'listvariable' in /usr/local/web/WLP/profiles/Variable.class on line 33 Warning: Use of undefined constant newvariable - assumed 'newvariable' in /usr/local/web/WLP/profiles/Variable.class on line 34 Warning: Use of undefined constant value - assumed 'value' in /usr/local/web/WLP/profiles/Variable.class on line 55 Warning: Undefined variable: siteowner in /usr/local/web/WLP/profiles/config.php3 on line 192 Warning: Use of undefined constant value - assumed 'value' in /usr/local/web/WLP/profiles/Variable.class on line 55 Warning: Undefined variable: xsitename in /usr/local/web/WLP/profiles/config.php3 on line 193 Warning: Use of undefined constant value - assumed 'value' in /usr/local/web/WLP/profiles/Variable.class on line 55 Warning: Use of undefined constant breakme - assumed 'breakme' in /usr/local/web/WLP/profiles/image.php3 on line 5 Warning: Undefined index: breakme in /usr/local/web/WLP/profiles/image.php3 on line 5 Which shouldn't be affecting things when the errors are turned off.. Those should be pretty innocent.. Mike -- Mike Gifford, OpenConcept Consulting, http://www.openconcept.ca Supporting progressive organizations in online campaigns and tools. Feature: Women's Learning Partnership http://learningpartnership.org Truth is that which confirms what we already believe. Northrop Frye |
From: nathan r. h. <na...@ds...> - 2001-12-31 18:22:32
|
On Mon, 31 Dec 2001, Mike Gifford wrote: > Hi Nathan, > > 1st - Damn your a good resource.. > Thanks :) > OK.. My present code looks like this: > > require('config.php3'); > class Image { > var $db; > function Image($ID='$GLOBALS[ID]') { No quotes in the above, it's not working cause $ID is being set to the string "$GLOBALS[ID]" and not the actual value of the global $ID (as a side note, this happen becasue you're using single quotes which casue literal strings, double quotes would have meant that the string would have been scanned for variable substituion and it would have been ok, but you would have paid a small performance penalty for that substitution. This is where knowing everything about your varibles comes in handy.) > $this->db = new DB_Sql; > $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; > $this->db->query($sql); > while ($this->db->next_record()) { > Header("Content-type: image/jpeg"); > print $this->db->Record['photo']; > } > } > } > > and produces only this: > <html><body></body></html> > > I just want to clarify though.. in the example you gave ($this->db = > new nameOfdbClass;), if I was trying to add this to phpSlash 6.2 > nameOfdbClass; would be DB_Sql (or would it be slashDB? > if all youre tables are in the same databse as the phpslash stuff, then slashDB, else you'll need to make a new subclass of DB_Sql. > Both seem to produce the same result for me.. I even tried commenting > out the header line (Header("Content-type: image/jpeg");) to see if that > would just echo the raw jpg data.. It didn't.. So something's goofing > up... > Make sure you're not outputing anything before that header() call. I bet there's an error creeping in (probably from using the wrong db class) that's casuing it. For something liek what you're doing I like to add a construct like this to the top of my code: if ($debug && $HTTP_GET_VARS[breakme]) { echo "I'm outputing something to break the headers.<br>\n"; echo "This will allow me to see what exactly I'm sending.<br>\n"; echo "Including errors :)<br>\n"; } Also, check to make sure (for debug pruposes) error_reporting is set to E_ALL. And FWIW, I'd do a $this->db->nf() and make sure the returned valus is 1 and if it isn't sending a "not availible" jpeg to the browser before entering the while() loop. This ensures that if the script freaks out and can't find a image in the databse, something is returned to the user indicating so :) -n -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- nathan hruby / digital statement na...@ds... http://www.dstatement.com/ Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: Mike G. <mi...@op...> - 2001-12-31 17:34:46
|
Hi Nathan, 1st - Damn your a good resource.. nathan r. hruby wrote: > require('config.php'); > class Image { > var $db; > // Suck in the ID from the GLOBALS array, handy becasue you can chnage > // the ID at runtime if'n ya want. > function Image($id = $GLOBALS[ID]) { > // Above you instance the wrong class (the one you're running, > // suprising this should have caused an infinate loop) > // The reason this wasn't working is beacus you never instanced the > // phplib class > $this->db = new nameOfdbClass; > $sql = "blah blah blah" > $this->db->query($sql); > while ($this->db->next_record()) { > header("here's an image"); > print $this->db->Record['photo']; > } > } > } OK.. My present code looks like this: require('config.php3'); class Image { var $db; function Image($ID='$GLOBALS[ID]') { $this->db = new DB_Sql; $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; $this->db->query($sql); while ($this->db->next_record()) { Header("Content-type: image/jpeg"); print $this->db->Record['photo']; } } } and produces only this: <html><body></body></html> I just want to clarify though.. in the example you gave ($this->db = new nameOfdbClass;), if I was trying to add this to phpSlash 6.2 nameOfdbClass; would be DB_Sql (or would it be slashDB? Both seem to produce the same result for me.. I even tried commenting out the header line (Header("Content-type: image/jpeg");) to see if that would just echo the raw jpg data.. It didn't.. So something's goofing up... > Note that you can ahould be able to run run imageSize() on the sql > refernce adn double check it's image type before sending the header. > Here's chuck of code I have for one project, you'll need to modify it for > your own purposes, but it's an ok example of imagesize() > function getType() { > if ($debug) { > echo "Getting Type"; > echo "image::getType() - type is $this->currImg['imagesize'][2]<br>\n"; > } > switch ($this->currImg['imageSize'][2]) { > case 1: > return("gif"); > break; > case 2: > return("jpeg"); > break; > case 3: > return("png"); > break; > case 4: > return("swf"); > break; > default: > return("unknown"); > break; > } > } This is useful code.. Likely better than the current upload script offers.. However, it is already using imagesize once to insert the data (not that you would know that), so there's no need to do it again afterwards.. Mike -- Mike Gifford, OpenConcept Consulting, http://www.openconcept.ca Supporting progressive organizations in online campaigns and tools. Feature: Women's Learning Partnership http://learningpartnership.org Truth is that which confirms what we already believe. Northrop Frye |
From: nathan r. h. <na...@ds...> - 2001-12-31 16:35:28
|
On Mon, 31 Dec 2001, Mike Gifford wrote: > Hello, > > I'm having a bit of trouble convincing a phplib class to produce an > image from a MySQL database.. > > So far I've got the following: > > require("config.php3"); > class Image { > var $db; > function Image() { > global $ID; > $img->db = new Image; > $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; > $img->db->query($sql); > while($img->db->next_record()) { > Header("Content-type: image/jpeg"); > echo $this->db->Record[photo]; > } > } > } > require('config.php'); class Image { var $db; // Suck in the ID from the GLOBALS array, handy becasue you can chnage // the ID at runtime if'n ya want. function Image($id = $GLOBALS[ID]) { // Above you instance the wrong class (the one you're running, // suprising this should have caused an infinate loop) // The reason this wasn't working is beacus you never instanced the // phplib class $this->db = new nameOfdbClass; $sql = "blah blah blah" $this->db->query($sql); while ($this->db->next_record()) { header("here's an image"); print $this->db->Record['photo']; } } } Note that you can ahould be able to run run imageSize() on the sql refernce adn double check it's image type before sending the header. Here's chuck of code I have for one project, you'll need to modify it for your own purposes, but it's an ok example of imagesize() function getType() { if ($debug) { echo "Getting Type"; echo "image::getType() - type is $this->currImg['imagesize'][2]<br>\n"; } switch ($this->currImg['imageSize'][2]) { case 1: return("gif"); break; case 2: return("jpeg"); break; case 3: return("png"); break; case 4: return("swf"); break; default: return("unknown"); break; } } -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- nathan hruby / digital statement na...@ds... http://www.dstatement.com/ Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: Layne W. <la...@of...> - 2001-12-31 15:24:47
|
> require("config.php3"); > class Image { > var $db; > function Image() { > global $ID; > $img->db = new Image; I think you might want to try instantiating your db class here instead of the image class you are creating. Try (with your class name): $img->db = new DB_Example; > $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; > $img->db->query($sql); > while($img->db->next_record()) { > Header("Content-type: image/jpeg"); > echo $this->db->Record[photo]; > } > } > } Layne Weathers Ifworld Inc. |
From: Mike G. <mi...@op...> - 2001-12-31 15:14:59
|
Hello, I'm having a bit of trouble convincing a phplib class to produce an image from a MySQL database.. So far I've got the following: require("config.php3"); class Image { var $db; function Image() { global $ID; $img->db = new Image; $sql="SELECT photo FROM WLPphoto WHERE profileID='$ID'"; $img->db->query($sql); while($img->db->next_record()) { Header("Content-type: image/jpeg"); echo $this->db->Record[photo]; } } } config.php3 has the database variables defined (much as they are set in phpSlash).. It's been a couple months since I've played with classes, so perhaps it's just that I'm just a bit rusty.. I'd like to generate a script to pull an image out of a database based on a $ID number. This all works fine outside of the phplib environment, but I can't figure out how to get this class to display any results.. Any suggestions? Mike -- Mike Gifford, OpenConcept Consulting, http://www.openconcept.ca Supporting progressive organizations in online campaigns and tools. Feature: Women's Learning Partnership http://learningpartnership.org Truth is that which confirms what we already believe. Northrop Frye |
From: Layne W. <la...@of...> - 2001-12-31 15:04:11
|
> How, using the current template.inc, can you repetitively use the > same template, expanded with different values, into other templates? > > Example: > > <!-- BEGIN top --> > (item) > <!-- END top --> > > <!-- BEGIN item --> > (links) > <!-- END item --> > > <!-- BEGIN block --> > (links) > <!-- END block --> > > <!-- BEGIN links --> > {link} > <!-- END BLOG_LINKS_BLOCK --> > > And I want "top" containing multiple instances of "item" and > "block", with each of those sub-blocks containing a different > "links". The obvious approach doesn't work because the first time I > parse "links" to then build a block or item the template is lost so > I can't come back later with a new value for "link" and gen a new > value to later shove in a new block or item. > > Am I missing something? Although you are parseing the "links" block into several places, you need to name the target variables separately ({some_links}, {some_other_links}, etc). Layne Weathers Ifworld Inc. |
From: J C L. <cl...@ka...> - 2001-12-31 04:03:50
|
On Mon, 31 Dec 2001 09:12:20 +0530 (IST) Tarique Sani <Dr> wrote: > On Sun, 30 Dec 2001, J C Lawrence wrote: >> While I don't mind doing a derived class for this, it seems a >> little questionable in terms of supporting reason. Adding >> conditional support requires adding an if() to subst(), a new >> method preproc(), > If the support is *turn off-able" and by default it is *off* then > I guess we should have it in the main template.inc it self. The patch I submitted defaults it to ON (as that's what I use and thus tested). However, the appropriate list is well documented and trivial to change/fix for whoever accepts the patch. var $use_preproc = 0; -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. cl...@ka... He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. |
From: Dr T. S. <ta...@na...> - 2001-12-31 03:56:57
|
On Sun, 30 Dec 2001, J C Lawrence wrote: > While I don't mind doing a derived class for this, it seems a little > questionable in terms of supporting reason. Adding conditional > support requires adding an if() to subst(), a new method preproc(), If the support is *turn off-able" and by default it is *off* then I guess we should have it in the main template.inc it self. Maintaining a derived class will be un-necessary additional overhead on the developers. Cheers Tarique -- ========================================================== PHP Applications for E-Biz : http://www.sanisoft.com The Ultimate Ghazal Lexicon: http://www.aaina-e-ghazal.com ========================================================== |
From: J C L. <cl...@ka...> - 2001-12-31 03:33:38
|
On Sun, 30 Dec 2001 13:20:59 -0500 (EST) nathan r hruby <na...@ds...> wrote: > On Sun, 30 Dec 2001, Tarique Sani <ta...@sa...> wrote: > I agree with the no logic in templates rule, it makes things very > complicated in terms of designing, espically when the descsions > could be made at the app level. This, in some ways, promotes bad > application design. Giving power to HTML jockeys also scares the > bejesus out of me ;) <nod> > That said, I can also see the use for condtional statements in the > tempalte system, there are times when it can be incredibly handy > (changing colors for roms in a table, lets say) and doing it at > the app level is harder and can, in some cases, cause addtional > unneeded overhead. This can be extra true (if there is such a > thing - true++ :) if you are given a codebase that just won't do > what you need it to do without serious reworking. I seem to specialise in finding those cases. Certainly I've been using IF/ELSE/ENDIF support in templates for the last two years now and loving it for a ugly corners it elegantly gets me out of. > JC, would you be willing to rework this patch as an extension > class to the current template class? Will you accept the backslash patch (already on SF) separately then? Its a good patch and should be accepted. > I'd be happy to include that as part of the phplib distribution, > and I think that it will make many people happier, not having to > have the condtional code in the class if they aren't using it. While I don't mind doing a derived class for this, it seems a little questionable in terms of supporting reason. Adding conditional support requires adding an if() to subst(), a new method preproc(), and a matching global to turn it on/off. Given how lightweight the patch is, and that its effects can be turned off (and probably should be off by default), I don't really see the value in abstracting it -- that just means that I/someone then has to maintain both versions of subst(). > This also makes maintenence of both bits easier for all of us. > I'd be happy to provide you with CVS wrote access if you'd like to > maintain it as well (though I could swear you have it already, > no?) If I do have CVS access its news to me (or news to those tired forgetful neurons). I guess I can maintain the conditional stuff if you want... -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. cl...@ka... He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. |
From: nathan r. h. <na...@ds...> - 2001-12-30 18:20:56
|
On Sun, 30 Dec 2001, Tarique Sani <ta...@sa...> wrote: > > Well this has been discussed often and it was agreed that template be kept > simple and strictly design oriented > > I also agree to it .... > > Anything which will confuse my dumb designer is bad :-( > > and most designers are not too good at logic .... > I agree with the no logic in templates rule, it makes things very complicated in terms of designing, espically when the descsions could be made at the app level. This, in some ways, promotes bad application design. Giving power to HTML jockeys also scares the bejesus out of me ;) That said, I can also see the use for condtional statements in the tempalte system, there are times when it can be incredibly handy (changing colors for roms in a table, lets say) and doing it at the app level is harder and can, in some cases, cause addtional unneeded overhead. This can be extra true (if there is such a thing - true++ :) if you are given a codebase that just won't do what you need it to do without serious reworking. JC, would you be willing to rework this patch as an extension class to the current template class? I'd be happy to include that as part of the phplib distribution, and I think that it will make many people happier, not having to have the condtional code in the class if they aren't using it. This also makes maintenence of both bits easier for all of us. I'd be happy to provide you with CVS wrote access if you'd like to maintain it as well (though I could swear you have it already, no?) Thanks, -n -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- nathan hruby / digital statement na...@ds... http://www.dstatement.com/ Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: J C L. <cl...@ka...> - 2001-12-30 11:16:09
|
On Sun, 30 Dec 2001 16:24:05 +0530 (IST) Tarique Sani <ta...@sa...>" <ro...@sa...> wrote: > On Sun, 30 Dec 2001, J C Lawrence wrote: > Well this has been discussed often and it was agreed that template > be kept simple and strictly design oriented <shrug> The patch doesn't change using the template code that way. It adds a simple internal boolean that toggles IF/ELSE/ENDIF support on/off. If you don't like it, just set the flag to 0. If you do like it and believe your local design staff can handle that, then set it to !0. > Anything which will confuse my dumb designer is bad :-( Err, then set the $use_preproc flag to 0. -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. cl...@ka... He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. |
From: J C L. <cl...@ka...> - 2001-12-30 11:12:14
|
How, using the current template.inc, can you repetitively use the same template, expanded with different values, into other templates? Example: <!-- BEGIN top --> (item) <!-- END top --> <!-- BEGIN item --> (links) <!-- END item --> <!-- BEGIN block --> (links) <!-- END block --> <!-- BEGIN links --> {link} <!-- END BLOG_LINKS_BLOCK --> And I want "top" containing multiple instances of "item" and "block", with each of those sub-blocks containing a different "links". The obvious approach doesn't work because the first time I parse "links" to then build a block or item the template is lost so I can't come back later with a new value for "link" and gen a new value to later shove in a new block or item. Am I missing something? -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. cl...@ka... He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. |