php-general Digest 9 May 2010 07:00:41 -0000 Issue 6734
php-general Digest 9 May 2010 07:00:41 - Issue 6734 Topics (messages 305013 through 305016): dynamically generating and retrieving page data using flat files 305013 by: David Mehler 305014 by: Karl DeSaulniers 305015 by: Al 305016 by: Adam Richardson Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- Hello, I've got a project that i have to reference information stored on one page from another. This page I won't be visiting first, and at the moment i'd prefer to use flat php files, but should that prove to hard i'll transition to a mysql database. I'm looking for simplicity and maintainability. I've got a page of individuals, their names, positions, and a brief summary of them. On the main page I want to put their names and positions in an ordered list, pulling that information from the second page. The idea is whenever the second page is updated the main page will automatically update. Suggestions welcome. Thanks. Dave. ---End Message--- ---BeginMessage--- Just a wild stab, but maybe hidden form fields and javascript pr php? Karl On May 8, 2010, at 8:41 PM, David Mehler wrote: Hello, I've got a project that i have to reference information stored on one page from another. This page I won't be visiting first, and at the moment i'd prefer to use flat php files, but should that prove to hard i'll transition to a mysql database. I'm looking for simplicity and maintainability. I've got a page of individuals, their names, positions, and a brief summary of them. On the main page I want to put their names and positions in an ordered list, pulling that information from the second page. The idea is whenever the second page is updated the main page will automatically update. Suggestions welcome. Thanks. Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com ---End Message--- ---BeginMessage--- On 5/8/2010 9:41 PM, David Mehler wrote: Hello, I've got a project that i have to reference information stored on one page from another. This page I won't be visiting first, and at the moment i'd prefer to use flat php files, but should that prove to hard i'll transition to a mysql database. I'm looking for simplicity and maintainability. I've got a page of individuals, their names, positions, and a brief summary of them. On the main page I want to put their names and positions in an ordered list, pulling that information from the second page. The idea is whenever the second page is updated the main page will automatically update. Suggestions welcome. Thanks. Dave. Consider using arrays. Give each individual a unique ID and use for your keys Serialize() the array and put_file_contents() file_get_contents and unserialize() ---End Message--- ---BeginMessage--- On Sat, May 8, 2010 at 9:41 PM, David Mehler dave.meh...@gmail.com wrote: Hello, I've got a project that i have to reference information stored on one page from another. This page I won't be visiting first, and at the moment i'd prefer to use flat php files, but should that prove to hard i'll transition to a mysql database. I'm looking for simplicity and maintainability. I've got a page of individuals, their names, positions, and a brief summary of them. On the main page I want to put their names and positions in an ordered list, pulling that information from the second page. The idea is whenever the second page is updated the main page will automatically update. Suggestions welcome. Thanks. Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Well, if you're seeking to avoid the DB, you could just make sure the second page is valid XHTML. Then the first page could just run a quick script that parses the XML of the second page to produce the data for the list on the first page. You could use simplexml (or dom, or the event parser, whatever you're comfortable with) to grab the info from the elements of second page and use the data as you need to in the generation of the first page. Without much work, you could even set up a short-term cache of the first page just so it renders quickly most of the time. Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com ---End Message---
Re: [PHP] dynamically generating and retrieving page data using flat files
On Sat, May 8, 2010 at 9:41 PM, David Mehler dave.meh...@gmail.com wrote: Hello, I've got a project that i have to reference information stored on one page from another. This page I won't be visiting first, and at the moment i'd prefer to use flat php files, but should that prove to hard i'll transition to a mysql database. I'm looking for simplicity and maintainability. I've got a page of individuals, their names, positions, and a brief summary of them. On the main page I want to put their names and positions in an ordered list, pulling that information from the second page. The idea is whenever the second page is updated the main page will automatically update. Suggestions welcome. Thanks. Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Well, if you're seeking to avoid the DB, you could just make sure the second page is valid XHTML. Then the first page could just run a quick script that parses the XML of the second page to produce the data for the list on the first page. You could use simplexml (or dom, or the event parser, whatever you're comfortable with) to grab the info from the elements of second page and use the data as you need to in the generation of the first page. Without much work, you could even set up a short-term cache of the first page just so it renders quickly most of the time. Adam -- Nephtali: PHP web framework that functions beautifully http://nephtaliproject.com
[PHP] xpath help
If I have a document containing, say: html body table tbody tr tdfont ...foo1/font/td tdfont ...bar1/font/td /tr tr td font ...foo2/font /td td font ...bar2/font /td /tr ... How do I get at bar2? I tried everything, based on an xpath from Firebug (Firefox plugin), but kept getting NULL. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xpath help
On 9 May 2010 10:31, Gary php-gene...@garydjones.name wrote: If I have a document containing, say: html body table tbody tr tdfont ...foo1/font/td tdfont ...bar1/font/td /tr tr td font ...foo2/font /td td font ...bar2/font /td /tr ... How do I get at bar2? I tried everything, based on an xpath from Firebug (Firefox plugin), but kept getting NULL. try //table//font - that should give you all the font elements in table elements. Given your layout, you're then looking for $list-item(3) Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP GD - Create a flag
On Sat, 2010-05-08 at 18:48 +0200, Giorgio wrote: Hi, i've just started using GD libraries. My purpose is to create something like a flag. So that i have a 600*600 px background image, and a 1*1 px image for each colour I need. Ok now let's say i want to colour a third of the background image. I can use this code: imagecopymerge($base, $img1, 0, 0, 0, 0, 200, 600, 85); It will simply make red first 200 px (on x axys) of the bg image. And this work. Now the problem is: how can i add another colour on pixels from 201 (201 right? not 200?) to 400? Thankyou Erm, why don't you use something like imagerectangle() ? It's far easier and less resource intensive than having loads of single-pixel images for each colour you want to use. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] PHP GD - Create a flag
Thankyou Ashley, as I only need 5 colors for each image, my idea was to create a single pixel image for each color and save it on the hd (so that i don't have to create it every time). I've finally used this code: imagecopymerge($base, $img1, 0, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img2, 100, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img3, 200, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img4, 300, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img5, 400, 0, 1, 1, 100, 500, 75); ($imgX are 1*1 images. I have a function that checks if they exists) You can see the output here: http://aagmns47.facebook.joyent.us/sdna/. I think that copying a 1*1 image (and as said i'll cache all 1*1 colors on the hd) on a background is less resource-expensive than creating a coloured rectangle every time, isn't it? Giorgio 2010/5/9 Ashley Sheridan a...@ashleysheridan.co.uk On Sat, 2010-05-08 at 18:48 +0200, Giorgio wrote: Hi, i've just started using GD libraries. My purpose is to create something like a flag. So that i have a 600*600 px background image, and a 1*1 px image for each colour I need. Ok now let's say i want to colour a third of the background image. I can use this code: imagecopymerge($base, $img1, 0, 0, 0, 0, 200, 600, 85); It will simply make red first 200 px (on x axys) of the bg image. And this work. Now the problem is: how can i add another colour on pixels from 201 (201 right? not 200?) to 400? Thankyou Erm, why don't you use something like imagerectangle() ? It's far easier and less resource intensive than having loads of single-pixel images for each colour you want to use. Thanks, Ash http://www.ashleysheridan.co.uk -- -- AnotherNetFellow Email: anothernetfel...@gmail.com
Re: [PHP] PHP GD - Create a flag
On Sun, 2010-05-09 at 14:21 +0200, Giorgio wrote: Thankyou Ashley, as I only need 5 colors for each image, my idea was to create a single pixel image for each color and save it on the hd (so that i don't have to create it every time). I've finally used this code: imagecopymerge($base, $img1, 0, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img2, 100, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img3, 200, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img4, 300, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img5, 400, 0, 1, 1, 100, 500, 75); ($imgX are 1*1 images. I have a function that checks if they exists) You can see the output here: http://aagmns47.facebook.joyent.us/sdna/. I think that copying a 1*1 image (and as said i'll cache all 1*1 colors on the hd) on a background is less resource-expensive than creating a coloured rectangle every time, isn't it? Giorgio 2010/5/9 Ashley Sheridan a...@ashleysheridan.co.uk On Sat, 2010-05-08 at 18:48 +0200, Giorgio wrote: Hi, i've just started using GD libraries. My purpose is to create something like a flag. So that i have a 600*600 px background image, and a 1*1 px image for each colour I need. Ok now let's say i want to colour a third of the background image. I can use this code: imagecopymerge($base, $img1, 0, 0, 0, 0, 200, 600, 85); It will simply make red first 200 px (on x axys) of the bg image. And this work. Now the problem is: how can i add another colour on pixels from 201 (201 right? not 200?) to 400? Thankyou Erm, why don't you use something like imagerectangle() ? It's far easier and less resource intensive than having loads of single-pixel images for each colour you want to use. Thanks, Ash http://www.ashleysheridan.co.uk No, you use imagerectangle() directly on the final image, no need to use imagecopymerge() at all! $colour1 = imagecolorallocate($base, 255, 105, 180); $colour2 = imagecolorallocate($base, 255, 255, 255); $colour3 = imagecolorallocate($base, 132, 135, 28); $colour4 = imagecolorallocate($base, 88, 105, 180); $colour5 = imagecolorallocate($base, 0, 0, 0); imagerectangle($base, 0, 0, 100, 500, $colour1); imagerectangle($base, 100, 0, 200, 500, $colour2); imagerectangle($base, 200, 0, 300, 500, $colour3); imagerectangle($base, 300, 0, 400, 500, $colour4); imagerectangle($base, 400, 0, 500, 500, $colour5); It looks like more code, but you'll really appreciate it if you get a lot of visitors who are triggering these images to be created dynamically. Copying a single-pixel image and resizing it into a much larger area is always going to be more costly than using the native imagerectangle() function. Also, the above way allows you to create the colours dynamically for the image from within your script, and not have to create a new 1x1 pixel image each time! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] PHP GD - Create a flag
On Sun, 2010-05-09 at 14:21 +0200, Giorgio wrote: Thankyou Ashley, as I only need 5 colors for each image, my idea was to create a single pixel image for each color and save it on the hd (so that i don't have to create it every time). I've finally used this code: imagecopymerge($base, $img1, 0, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img2, 100, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img3, 200, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img4, 300, 0, 1, 1, 100, 500, 75); imagecopymerge($base, $img5, 400, 0, 1, 1, 100, 500, 75); ($imgX are 1*1 images. I have a function that checks if they exists) You can see the output here: http://aagmns47.facebook.joyent.us/sdna/. I think that copying a 1*1 image (and as said i'll cache all 1*1 colors on the hd) on a background is less resource-expensive than creating a coloured rectangle every time, isn't it? Giorgio 2010/5/9 Ashley Sheridan a...@ashleysheridan.co.uk On Sat, 2010-05-08 at 18:48 +0200, Giorgio wrote: Hi, i've just started using GD libraries. My purpose is to create something like a flag. So that i have a 600*600 px background image, and a 1*1 px image for each colour I need. Ok now let's say i want to colour a third of the background image. I can use this code: imagecopymerge($base, $img1, 0, 0, 0, 0, 200, 600, 85); It will simply make red first 200 px (on x axys) of the bg image. And this work. Now the problem is: how can i add another colour on pixels from 201 (201 right? not 200?) to 400? Thankyou Erm, why don't you use something like imagerectangle() ? It's far easier and less resource intensive than having loads of single-pixel images for each colour you want to use. Thanks, Ash http://www.ashleysheridan.co.uk Sorry, use imagefilledrectangle() instead of imagerectangle() in the example I just gave you! Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] CSS - Image or object Slide left/right and fade in using jquery
Does anyone have any resources that demonstrates using jquery to have an image or object slide in from the left and then fade in. I would appreciate it. Thanks! Don Wieland D W D a t a C o n c e p t s ~ d...@dwdataconcepts.com Direct Line - (949) 305-2771 Integrated data solutions to fit your business needs. Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at: http://www.dwdataconcepts.com/DevSup.html Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher http://www.appointment10.com For a quick overview - http://www.appointment10.com/Appt10_Promo/Overview.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS - Image or object Slide left/right and fade in using jquery
On Sun, 2010-05-09 at 06:28 -0700, Don Wieland wrote: Does anyone have any resources that demonstrates using jquery to have an image or object slide in from the left and then fade in. I would appreciate it. Thanks! Don Wieland D W D a t a C o n c e p t s ~ d...@dwdataconcepts.com Direct Line - (949) 305-2771 Integrated data solutions to fit your business needs. Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at: http://www.dwdataconcepts.com/DevSup.html Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher http://www.appointment10.com For a quick overview - http://www.appointment10.com/Appt10_Promo/Overview.html And I assume you're going to be outputting everything with PHP? :p http://jquery.malsup.com/cycle/ is a good plugin for transitions between objects in JQuery. It's mostly used for image galleries, but can be adapted to pretty much anything. Ps. any chance you could trim your signature down a tiny bit. At the moment, it's 3 times longer than your actual message! Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] PHP Encoder like IonCube
Is there any php encoder like IonCube ? Looking for an opensource solution. My main target is to deliver encoded php codes so that it can not be re-engineered. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] __call and recursion
Hello, I've defined a __call() method inside a class. Within the __call() method (after testing that the method exists and is callable I am using: call_user_func_array(array($this,$method), $args); However, this seems to be an infinite loop (and is crashing my test apache server). How, could I still use the __call() method and avoid an infinite loop of calling? Thanks, dK ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] __call and recursion
On 9 May 2010 23:21, Daniel Kolbo kolb0...@umn.edu wrote: Hello, I've defined a __call() method inside a class. Within the __call() method (after testing that the method exists and is callable I am using: call_user_func_array(array($this,$method), $args); However, this seems to be an infinite loop (and is crashing my test apache server). How, could I still use the __call() method and avoid an infinite loop of calling? Assuming that your __call() method was reached because no $method was defined, using call_user_func_array() to call $method on the same object is going to result in ... your __call() method getting called again. You need to map the $method to whichever class methods you *actually* want to call, instead of blindly trying to reissue the call. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] __call and recursion
On Sun, May 9, 2010 at 3:25 PM, Peter Lind peter.e.l...@gmail.com wrote: On 9 May 2010 23:21, Daniel Kolbo kolb0...@umn.edu wrote: Hello, I've defined a __call() method inside a class. Within the __call() method (after testing that the method exists and is callable I am using: call_user_func_array(array($this,$method), $args); However, this seems to be an infinite loop (and is crashing my test apache server). How, could I still use the __call() method and avoid an infinite loop of calling? Assuming that your __call() method was reached because no $method was defined, using call_user_func_array() to call $method on the same object is going to result in ... your __call() method getting called again. You need to map the $method to whichever class methods you *actually* want to call, instead of blindly trying to reissue the call. according to op it sounds like hes not blindly reissuing the call, (after testing that the method exists and is callable I am using: anyways, Daniel, your code seems sound, hard to say where the recursion is coming from. why not just dump the methods youre trying to invoke via var_dump() or error_log() etc? eg .. var_dump($method); call_user_func_array(array($this,$method), $args); -nathan
Re: [PHP] __call and recursion
On 9 May 2010 23:56, Nathan Nobbe quickshif...@gmail.com wrote: On Sun, May 9, 2010 at 3:25 PM, Peter Lind peter.e.l...@gmail.com wrote: On 9 May 2010 23:21, Daniel Kolbo kolb0...@umn.edu wrote: Hello, I've defined a __call() method inside a class. Within the __call() method (after testing that the method exists and is callable I am using: call_user_func_array(array($this,$method), $args); However, this seems to be an infinite loop (and is crashing my test apache server). How, could I still use the __call() method and avoid an infinite loop of calling? Assuming that your __call() method was reached because no $method was defined, using call_user_func_array() to call $method on the same object is going to result in ... your __call() method getting called again. You need to map the $method to whichever class methods you *actually* want to call, instead of blindly trying to reissue the call. according to op it sounds like hes not blindly reissuing the call, (after testing that the method exists and is callable I am using: Good point that, misread. Would be good to see the code checking availability of the method, to get some idea of the error. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoder like IonCube
bcompiler is available, but with the correct tools data can still be extracted. http://php.net/manual/en/book.bcompiler.php On May 9, 2010, at 4:36 PM, shiplu wrote: Is there any php encoder like IonCube ? Looking for an opensource solution. My main target is to deliver encoded php codes so that it can not be re-engineered. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php