php-general Digest 27 Nov 2007 14:14:02 -0000 Issue 5150

Topics (messages 265039 through 265065):

PHP file slow, same file in HTML faster
        265039 by: Jose Toroscani Hernandez
        265056 by: Colin Guthrie

Create PDFs with a strict layout automatically
        265040 by: David Christopher Zentgraf
        265041 by: Chris
        265042 by: David Christopher Zentgraf
        265043 by: tedd
        265044 by: tedd
        265045 by: Bastien Koert
        265046 by: David Christopher Zentgraf
        265048 by: Brady Mitchell
        265050 by: David Christopher Zentgraf
        265053 by: Brady Mitchell
        265054 by: David Christopher Zentgraf
        265055 by: Brady Mitchell

Re: Representing microtime() values
        265047 by: tedd
        265049 by: Tomi Kaistila
        265052 by: Zoltán Németh
        265057 by: Tomi Kaistila

Convertig xml into array
        265051 by: Dave Goodchild
        265058 by: Edward Kay
        265059 by: Colin Guthrie

Gallery Script
        265060 by: Tom Chubb
        265061 by: Colin Guthrie
        265062 by: Tom Chubb
        265064 by: Tom Chubb

Newbie asks about multi-lingual website strategies
        265063 by: Jeff Benetti

Re: Emailing dilemma
        265065 by: George Pitcher

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
All  .php files are displayed in 10 seconds (aprox).
Example:  test.php
<html><body>hello world</body></html>

But, the same file with extension html   (test.html), is displayed in 1 second.


The system is:
- RHEL 5
- PHP 5.1
- Apache

I apreciate your help.

Toroscani

--- End Message ---
--- Begin Message ---
Jose Toroscani Hernandez wrote:
> All  .php files are displayed in 10 seconds (aprox).
> Example:  test.php
> <html><body>hello world</body></html>
> 
> But, the same file with extension html   (test.html), is displayed in 1 
> second.
> 
> 
> The system is:
> - RHEL 5
> - PHP 5.1
> - Apache
> 
> I apreciate your help.

There is probably some initialisation that PHP is doing that slowing
things down. I find that usually this kind of thing is caused by DNS
lookups and the like, but it could be any number of things. If you have
a modular build, try disabling all the PHP extensions and ensure that a
minimal system is quick then enable the extensions one by one and see
where it goes bang.

HTH

Col

--- End Message ---
--- Begin Message ---
Hi,

I want to offer visitors of my site the possibility of downloading printable, foldable pocket guides for certain things that come out of my database. The problem is that items will be entered into the database very frequently, so I need to automate the process of creating these guides. Since they're supposed to work like flyers, with a proper front and back etc, the layout will need to be very strict and adhere to a template. I was thinking about PDFs, since they should keep their layout in print no matter what. But how would I create PDFs from a template on the fly using PHP?
Or is HTML with a special print style sheet the better solution?

Anybody have any experience?

Chrs,
Dav

--- End Message ---
--- Begin Message ---
David Christopher Zentgraf wrote:
Hi,

I want to offer visitors of my site the possibility of downloading printable, foldable pocket guides for certain things that come out of my database. The problem is that items will be entered into the database very frequently, so I need to automate the process of creating these guides. Since they're supposed to work like flyers, with a proper front and back etc, the layout will need to be very strict and adhere to a template. I was thinking about PDFs, since they should keep their layout in print no matter what. But how would I create PDFs from a template on the fly using PHP?

There are a few packages you can use.

http://pear.php.net/package/File_PDF
http://www.fpdf.org/

are two I know of, I'm sure there are more.

If you have the choice maybe the php extension is an option:

http://php.net/pdf

but that requires a module be built into php.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
On 27 Nov 2007, at 11:51, Chris wrote:

There are a few packages you can use.

http://pear.php.net/package/File_PDF
http://www.fpdf.org/

are two I know of, I'm sure there are more.

Thanks! The built-in PDFlib functions didn't seem to appealing, but FPDF looks pretty good. I'll certainly play around with it to see what it can do, but right of the bat it seems that templates aren't supported the way I would like them to. Importing a PDF is possible, but apparently they can only be treated like images.

Chrs,
Dav

--- End Message ---
--- Begin Message ---
At 11:46 AM +0900 11/27/07, David Christopher Zentgraf wrote:
Hi,

I want to offer visitors of my site the possibility of downloading printable, foldable pocket guides for certain things that come out of my database. The problem is that items will be entered into the database very frequently, so I need to automate the process of creating these guides. Since they're supposed to work like flyers, with a proper front and back etc, the layout will need to be very strict and adhere to a template. I was thinking about PDFs, since they should keep their layout in print no matter what. But how would I create PDFs from a template on the fly using PHP?
Or is HTML with a special print style sheet the better solution?

Anybody have any experience?

Chrs,
Dav

Dav:

It can be done, check this out:

http://webbytedd.com/bb/pdf/

I created this by using:

http://www.fpdf.org/

You could just as easily pull it from a dB.

Cheers,

tedd


--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
At 12:16 PM +0900 11/27/07, David Christopher Zentgraf wrote:
On 27 Nov 2007, at 11:51, Chris wrote:

There are a few packages you can use.

http://pear.php.net/package/File_PDF
http://www.fpdf.org/

are two I know of, I'm sure there are more.

Thanks! The built-in PDFlib functions didn't seem to appealing, but FPDF looks pretty good. I'll certainly play around with it to see what it can do, but right of the bat it seems that templates aren't supported the way I would like them to. Importing a PDF is possible, but apparently they can only be treated like images.

Chrs,
Dav


Dav:

You don't import the PDF's but rather create them on the fly.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
you could also look at http://www.digitaljunkies.ca/dompdf/
 
bastien> CC: [EMAIL PROTECTED]> From: [EMAIL PROTECTED]> To: [EMAIL PROTECTED]> 
Date: Tue, 27 Nov 2007 12:16:45 +0900> Subject: Re: [PHP] Create PDFs with a 
strict layout automatically> > On 27 Nov 2007, at 11:51, Chris wrote:> > > 
There are a few packages you can use.> >> > 
http://pear.php.net/package/File_PDF> > http://www.fpdf.org/> >> > are two I 
know of, I'm sure there are more.> > Thanks! The built-in PDFlib functions 
didn't seem to appealing, but > FPDF looks pretty good. I'll certainly play 
around with it to see what > it can do, but right of the bat it seems that 
templates aren't > supported the way I would like them to. Importing a PDF is 
possible, > but apparently they can only be treated like images.> > Chrs,> Dav> 
> -- > PHP General Mailing List (http://www.php.net/)> To unsubscribe, visit: 
http://www.php.net/unsub.php> 
_________________________________________________________________
Have fun while connecting on Messenger! Click here to learn more.
http://entertainment.sympatico.msn.ca/WindowsLiveMessenger

--- End Message ---
--- Begin Message ---
On 27 Nov 2007, at 12:25, Bastien Koert wrote:

you could also look at http://www.digitaljunkies.ca/dompdf/

Looks alright, but I'm wondering whether the results might be more accurate by laying the PDF out "by hand", instead of going through an intermediary step with CSS? I was also looking at http://pdml.sourceforge.net with the same mixed feelings.

Chrs,
Dav

--- End Message ---
--- Begin Message ---
David Christopher Zentgraf wrote:
I'll certainly play around with it to see what it can do, but right of the bat it seems that templates aren't supported the way I would like them to. Importing a PDF is possible, but apparently they can only be treated like images.
I had a similar situation where I needed to fill in the blanks on an existing PDF file. I used the createFDF function from http://koivi.com/fill-pdf-form-fields in combination with pdftk (http://www.accesspdf.com/pdftk/) to merge the fdf data and pdf file into one.

Take a look at the fill_form and flatten options of pdftk.

Brady

--- End Message ---
--- Begin Message ---
On 27 Nov 2007, at 14:09, Brady Mitchell wrote:

I had a similar situation where I needed to fill in the blanks on an existing PDF file. I used the createFDF function from http://koivi.com/fill-pdf-form-fields in combination with pdftk (http://www.accesspdf.com/pdftk/) to merge the fdf data and pdf file into one.

Take a look at the fill_form and flatten options of pdftk.

Thanks, but by now I'm pretty much sold on the idea of FPDF and creating PDFs on the fly, inserting data I need as I go. Is there any advantage using pdftk?

Chrs,
Dav

--- End Message ---
--- Begin Message ---
David Christopher Zentgraf wrote:
Thanks, but by now I'm pretty much sold on the idea of FPDF and creating PDFs on the fly, inserting data I need as I go. Is there any advantage using pdftk?
The only advantage would be that others could create the PDFs and give them to you.

I used this setup to allow region offices to send me the PDF that they wanted to be used for generating reports for their users. I gave them a list of field names and they were able to choose which ones to include on the report, which order, etc.

FPDF is a great way to go - I've used it for other projects. Thought I'd share this method so you'd have more options. :)

Brady

--- End Message ---
--- Begin Message ---
On 27 Nov 2007, at 17:57, Brady Mitchell wrote:

FPDF is a great way to go - I've used it for other projects. Thought I'd share this method so you'd have more options. :)

Very much appreciated. :o)

I do want to include graphics dynamically as well, not just form data, so I think your approach wouldn't be quite as suited anyway(?).

Chrs,
Dav

--- End Message ---
--- Begin Message ---
David Christopher Zentgraf wrote:
On 27 Nov 2007, at 17:57, Brady Mitchell wrote:

FPDF is a great way to go - I've used it for other projects. Thought I'd share this method so you'd have more options. :)

Very much appreciated. :o)

I do want to include graphics dynamically as well, not just form data, so I think your approach wouldn't be quite as suited anyway(?).
Yeah, it sounds like your project is better suited for FPDF than I originally thought. I saw "template" and that made me think of using pdftk to fill in PDFs generated elsewhere.

Brady

--- End Message ---
--- Begin Message ---
At 9:30 PM +0200 11/26/07, Tomi Kaistila wrote:
Hi everyone

Here's a small problem that I haven't been able to figure out and hence I
figured I'd post and see if anyone can explain this to me.

-snip-

How exactly does PHP handle these values internally? Does anyone know?

Tomi:

Try this:

http://www.webbytedd.com/b/timed/

HTH's

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
>>Hi everyone
>>
>>Here's a small problem that I haven't been able to figure out and hence I
>>figured I'd post and see if anyone can explain this to me.
>>
>>-snip-
>>
>How exactly does PHP handle these values internally? Does anyone know?
>
>Tomi:
>
>Try this:
>
>http://www.webbytedd.com/b/timed/
>
>HTH's
>
>tedd

Thanks Tedd, but that's not really what I asked for. The difference in your
script is that it doesn't use the TRUE flag (unlike the script given on
PHP's manual). But not much of anything else. PHP still behaves the same way
with the float numbers when you try to look at them. And that is the part
that I wish to understand.

PHP clearly stores a number with more than two decimal points when you call
microtime(). But when you print it, it only shows two.

Why is this?


Tomi Kaistila
PHP Developer

--- End Message ---
--- Begin Message ---
2007. 11. 27, kedd keltezéssel 09.46-kor Tomi Kaistila ezt írta:
> >>Hi everyone
> >>
> >>Here's a small problem that I haven't been able to figure out and hence I
> >>figured I'd post and see if anyone can explain this to me.
> >>
> >>-snip-
> >>
> >How exactly does PHP handle these values internally? Does anyone know?
> >
> >Tomi:
> >
> >Try this:
> >
> >http://www.webbytedd.com/b/timed/
> >
> >HTH's
> >
> >tedd
> 
> Thanks Tedd, but that's not really what I asked for. The difference in your
> script is that it doesn't use the TRUE flag (unlike the script given on
> PHP's manual). But not much of anything else. PHP still behaves the same way
> with the float numbers when you try to look at them. And that is the part
> that I wish to understand.
> 
> PHP clearly stores a number with more than two decimal points when you call
> microtime(). But when you print it, it only shows two.

that seems to me like a floating point precision issue. after all, the
integer part of the microtime result is a quite big number...

I even tried a workaround like

$a = explode(' ', microtime());
echo $a[0] + $a[1];

but it resulted in the exact same result like microtime(true)

anyone knows something for sure?

greets
Zoltán Németh

> 
> Why is this?
> 
> 
> Tomi Kaistila
> PHP Developer
> 

--- End Message ---
--- Begin Message ---
>> >>Hi everyone
>> >>
>> >>Here's a small problem that I haven't been able to figure out and hence I
>> >>figured I'd post and see if anyone can explain this to me.
>> >>
>> >>-snip-
>> >>
>> >How exactly does PHP handle these values internally? Does anyone know?
>> >
>> >Tomi:
>> >
>> >Try this:
>> >
>> >http://www.webbytedd.com/b/timed/
>> >
>> >HTH's
>> >
>> >tedd
>> 
>> Thanks Tedd, but that's not really what I asked for. The difference in your
>> script is that it doesn't use the TRUE flag (unlike the script given on
>> PHP's manual). But not much of anything else. PHP still behaves the same way
>> with the float numbers when you try to look at them. And that is the part
>> that I wish to understand.
>> 
>> PHP clearly stores a number with more than two decimal points when you call
>> microtime(). But when you print it, it only shows two.

>that seems to me like a floating point precision issue. after all, the
>integer part of the microtime result is a quite big number...
>
>I even tried a workaround like
>
>$a = explode(' ', microtime());
>echo $a[0] + $a[1];
>
>but it resulted in the exact same result like microtime(true)
>
>anyone knows something for sure?
>
>greets
>Zoltán Németh 

Precision issue is what I also thought of. But it does seem quite strange to me 
that anything with more than two float points would loss precision so badly it 
isn't worth letting people to print out.

Here is one workaround:

$a = explode(' ', microtime());
echo bcadd($a[0], $a[1], 6);

But this way the output is a string. Casting it implicitly as integer will 
erase the floating points. As will passing it into the round() function.

Anyone know a workaround without using the bcmath library?


Tomi Kaistila
PHP Developer

--- End Message ---
--- Begin Message ---
Hi guys. I have the following XML file which I want to convert into a
multidimensional array. I am using PHP5 so don't want to use
SimpleXML as apparently there are issues with sessions and after
conversion I want to pass this array into the session. Any ideas on
the best and cleanest way to do this?

<?xml version="1.0" encoding="UTF-8"?>
<cpl_export>
 <setup>
    <version>0.1</version>
     <url>http://cpl.jellyfish.co.uk/service/</url>
 </setup>
 <id>userid</id>
 <items>

        <item id="1" selected="TRUE">
            <price>19.99</price>
            <renewal_price>25.99</renewal_price>
            <frequency>monthly</frequency>
            <description><![CDATA[Description of Item]]></description>
            <discount>20%</discount>
            <payment_types>

                <payment_type id="1">
                    Credit Card
                </payment_type>
                <payment_type id="2">
                    Direct Debit
                </payment_type>
            </payment_types>
            <media_code>12345</media_code>
            <item_type>gift</item_type>

            <zones>
                <zone>UK</zone>
                <zone>EIRE</zone>
                <zone>CHEESE</zone>
            </zones>
        </item>
        <item id="2" selected="FALSE">

            <price>8.99</price>
            <renewal_price>12.99</renewal_price>
            <frequency>annually</frequency>
            <description><![CDATA[Description of Item]]></description>
            <discount>25%</discount>
            <payment_types>
                <payment_type id="1">

                    Credit Card
                </payment_type>
                <payment_type id="2">
                    Direct Debit
                </payment_type>
            </payment_types>
            <media_code>12345</media_code>
            <item_type>standard subscription</item_type>
            <zones>

                <zone>UK</zone>
                <zone>EIRE</zone>
                <zone>CHEESE</zone>
            </zones>
        </item>
    </items>
 <form_elements>

    <page name="signup1">
            <content_header>
            <![CDATA[Some content for this pages header]]>
            </content_header>
            <content_footer>
            <![CDATA[Some content for this pages footer]]>
            </content_footer>
            <fieldset id="intro">
                <field id="firstname">

                    Enter your first name:
                </field>
                <field id="surname">
                    Enter your surnane:
                </field>
                <field id="email">
                    Enter your email address:
                </field>
            </fieldset>
        </page>

 </form_elements>
 <skinning>
        <skin id="header" alt="Sign up, you lovely
customer!">campaign_header.jpg</skin>
        <skin id="logo" alt="Some Magazine Logo">logo.jpg</skin>
        <skin id="submit_button">submit.jpg</skin>
 </skinning>
</cpl_export>

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Dave Goodchild [mailto:[EMAIL PROTECTED]
> Sent: 27 November 2007 08:36
> To: PHP General list
> Subject: [PHP] Convertig xml into array
>
>
> Hi guys. I have the following XML file which I want to convert into a
> multidimensional array. I am using PHP5 so don't want to use
> SimpleXML as apparently there are issues with sessions and after
> conversion I want to pass this array into the session. Any ideas on
> the best and cleanest way to do this?
>
> <snip>

Hi Dave,

The issue with sessions is simply that SimpleXML objects do not persist in
sessions. To workaround this, just use the asXML() function so your XML is
stored as a string in the session. You can then recreate the SimpleXML
object from this string as and when you need it.

Edward

--- End Message ---
--- Begin Message ---
Edward Kay wrote:
>> -----Original Message-----
>> From: Dave Goodchild [mailto:[EMAIL PROTECTED]
>> Sent: 27 November 2007 08:36
>> To: PHP General list
>> Subject: [PHP] Convertig xml into array
>>
>>
>> Hi guys. I have the following XML file which I want to convert into a
>> multidimensional array. I am using PHP5 so don't want to use
>> SimpleXML as apparently there are issues with sessions and after
>> conversion I want to pass this array into the session. Any ideas on
>> the best and cleanest way to do this?
>>
>> <snip>
> 
> Hi Dave,
> 
> The issue with sessions is simply that SimpleXML objects do not persist in
> sessions. To workaround this, just use the asXML() function so your XML is
> stored as a string in the session. You can then recreate the SimpleXML
> object from this string as and when you need it.

You can create a class derived from the SimpleXML objects that implement
__sleep and __wakeup that do this for you transparently.... just make
sure the classes are loaded prior to the session starting (or use autoload)

Col

--- End Message ---
--- Begin Message ---
Hi all,
I have a working gallery script which reads a directory then shows all
thumbnails, each linking to the full size image.
I'm trying to change it so that the page shows an image (fullsize)
then links to the previous/next images in the sequence & then all the
thumbnails below (the bit that's working fine at the moment). The
filenames are straight from the camera (eg DSC102834.jpg or something)
so I know that I need to get all the filenames into an array then use
the key indexing or something, but I'm not sure how to do it?
Also I'm not sure if I should be using readdir or glob?

I've modified the code below so that it just displays the text of the
filename rather than the actual image to speed up testing/reduce
bandwidth.

If anyone could point me in the right direction I'd really appreciate it

Here is my code:

<?
$folder = "images/";
echo "<table>\r\n<tr>\r\n";
$count = 0;
if(is_dir($folder))
        { if($handle = opendir($folder))
                { while(($file = readdir($handle)) !== false)
                        { //Filter out any unwanted files
                        if ($file !="thumbs.db" && $file !="_notes" && 
!is_dir($file))
                                {
                                echo "<td><a href=\"" . $file . "\">" . $file . 
"</a></td>\r\n";
                                $count++;
                                if (($count % 4) == 0)
                                        { echo "</tr>\r\n";
                                        echo "<tr>\r\n";
                                        }
                                }       
                        }
                closedir($handle);
                }
        }
echo "</tr>\r\n</table>\r\n";
echo "<br>\r\n";
echo "There are " . $count . " photos";
?>

--- End Message ---
--- Begin Message ---
Tom Chubb wrote:
> Hi all,
> I have a working gallery script which reads a directory then shows all
> thumbnails, each linking to the full size image.
> I'm trying to change it so that the page shows an image (fullsize)
> then links to the previous/next images in the sequence & then all the
> thumbnails below (the bit that's working fine at the moment). The
> filenames are straight from the camera (eg DSC102834.jpg or something)
> so I know that I need to get all the filenames into an array then use
> the key indexing or something, but I'm not sure how to do it?
> Also I'm not sure if I should be using readdir or glob?
> 
> I've modified the code below so that it just displays the text of the
> filename rather than the actual image to speed up testing/reduce
> bandwidth.
> 
> If anyone could point me in the right direction I'd really appreciate it

If you don't mind relying on javascript then take a look at lightbox or
thickbox and similar soltuions.

These are solutions where you only need to generate a gallery page with
the thumbnails and it will do the rest for you complete with
previous/next links and even thumbnails...

Col

--- End Message ---
--- Begin Message ---
On 27/11/2007, Colin Guthrie <[EMAIL PROTECTED]> wrote:
> Tom Chubb wrote:
> > Hi all,
> > I have a working gallery script which reads a directory then shows all
> > thumbnails, each linking to the full size image.
> > I'm trying to change it so that the page shows an image (fullsize)
> > then links to the previous/next images in the sequence & then all the
> > thumbnails below (the bit that's working fine at the moment). The
> > filenames are straight from the camera (eg DSC102834.jpg or something)
> > so I know that I need to get all the filenames into an array then use
> > the key indexing or something, but I'm not sure how to do it?
> > Also I'm not sure if I should be using readdir or glob?
> >
> > I've modified the code below so that it just displays the text of the
> > filename rather than the actual image to speed up testing/reduce
> > bandwidth.
> >
> > If anyone could point me in the right direction I'd really appreciate it
>
> If you don't mind relying on javascript then take a look at lightbox or
> thickbox and similar soltuions.
>
> These are solutions where you only need to generate a gallery page with
> the thumbnails and it will do the rest for you complete with
> previous/next links and even thumbnails...
>
> Col
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I'm not against using Javascript, but I'd like to learn more about how
to do it in PHP. (Admittedly it would probably be better in
Javascript!)

--- End Message ---
--- Begin Message ---
On 27/11/2007, Andrew Peterson <[EMAIL PROTECTED]> wrote:
> I'm assuming that everytime you page refreshes, it pulls in ALL the contents
> of the directory?
>
> If you are, you could dynamically create the Prev/Next buttons.  When you
> create the link for each individual pictures, you could add the prev and
> next files to the link:
>
>
> $pictureLink = "<a
> href="picture.php?picture=pic2.jpeg&prev=pic1.jpeg&next=pid3.jpeg">Picture
> 2</a>
>
> Make sense?
>
> -Andrew
>
>
> PS - You could also google "PHP Photo Gallery", there are TON of scripts out
> there.
>
>
>
>
> On Nov 27, 2007 7:20 AM, Tom Chubb <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > On 27/11/2007, Colin Guthrie <[EMAIL PROTECTED]> wrote:
> > > Tom Chubb wrote:
> > > > Hi all,
> > > > I have a working gallery script which reads a directory then shows all
> > > > thumbnails, each linking to the full size image.
> > > > I'm trying to change it so that the page shows an image (fullsize)
> > > > then links to the previous/next images in the sequence & then all the
> > > > thumbnails below (the bit that's working fine at the moment). The
> > > > filenames are straight from the camera (eg DSC102834.jpg or something)
> > > > so I know that I need to get all the filenames into an array then use
> > > > the key indexing or something, but I'm not sure how to do it?
> > > > Also I'm not sure if I should be using readdir or glob?
> > > >
> > > > I've modified the code below so that it just displays the text of the
> > > > filename rather than the actual image to speed up testing/reduce
> > > > bandwidth.
> > > >
> > > > If anyone could point me in the right direction I'd really appreciate
> it
> > >
> > > If you don't mind relying on javascript then take a look at lightbox or
> > > thickbox and similar soltuions.
> > >
> > > These are solutions where you only need to generate a gallery page with
> > > the thumbnails and it will do the rest for you complete with
> > > previous/next links and even thumbnails...
> > >
> > > Col
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> > I'm not against using Javascript, but I'd like to learn more about how
> > to do it in PHP. (Admittedly it would probably be better in
> > Javascript!)
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>


-- 
Tom Chubb
[EMAIL PROTECTED]
07912 202846
Thanks Andrew,
It's the link for the first image I'm having problems with.
I can create a table with all the images, but I can't work out how to
specify a single image to use as the main (larger image)
Let's say that I've got 4 images called img1, img2, img3, img4. The
script gets the filenames using readdir() but how do I associate the
results with one image, eg img3? I thought it would be something like
$files[2] then the prev/next would be $files[1] & $files[2]

The section of code is:


if ($file !="thumbs.db" && $file !="_notes" && !is_dir($file))
                               {
                               echo "<td><a href=\"" . $file . "\">" .
$file . "</a></td>\r\n";
                               $count++;
                               if (($count % 4) == 0)
                                       { echo "</tr>\r\n";
                                       echo "<tr>\r\n";
                                       }
                               }
                       }


Any ideas?

--- End Message ---
--- Begin Message ---
I'm a noob so keep the comments to a noob's level please.

I am doing a website and my client wants the bulk of the text to be
bilingual (French and English).  The last site I did used php and mysql so I
am getting comfortable with that technology.  Typically I am using a single
php file and my menu constantly points to the same file with different id
options example "index.php?id=30" and I want to use the same idea to choose
a language example "index.php?lang=fr&id=30".  Pretty straight forward for
many of you folks but before I start reinventing the wheel I wondered if
anyone could offer any suggestions.  I have a couple of approaches in mind.

1: Session vars, I have never used this but it seems straight forward.
Drawbacks?
2: Cookies again not too big a deal, never used cookies either but it
doesn't seem to be mystifying however the fact that the user can turn
cookies off makes me not want to go this route.
3: Use the mysql database and log each ip address and record the preference
and maybe the last time on the site.  I am leaning in this direction because
I think it is the most robust but will it be slow?  First I have to get the
ip then I have to check to see if it is in my data base and then get the
language preference.  It would be great to have a standardized function that
I could use on all of my sites.  I live in a bilingual country (Canada) so
this could be a real selling point for my services.

Any any and all comments are welcome, it will be a learning curve no matter
which route I take so a little advice on the best direction pros cons would
be great.

And of course knowing that I will have many many thousands of people on my
site (hee hee) which option will perform best once I start accumulating
vistors.  That's one problem I see with the mysql solution, I think it may
start to be slow unless I start purging vistors who have not shown up in a
while or limit the number of entries.

Thanks,
Jeff

--- End Message ---
--- Begin Message ---
Miles,

I see that tha manual talks about a trusted sender list
(/etc/mail/trusted-users). Do you know if there is something similar for a
Windows NT server?

Cheers

George

> -----Original Message-----
> From: Miles Thompson [mailto:[EMAIL PROTECTED]
> Sent: 26 November 2007 8:44 pm
> To: PHP List
> Subject: Re: [PHP] Emailing dilemma
>
>
> George,
>
> Had this problem a year ago, although I'm not using PEAR. Have a look at
> http://ca3.php.net/manual/en/function.mail.php
> and this down in the additional_parameters(optional) section:
>
> "For example, this can be used to set the envelope sender address
> when using
> sendmail with the *-f* sendmail option."
>
> It is not well documented, don't know if this helps, but it may get you
> started.
>
> Cheers - Miles
>
> On Nov 26, 2007 3:21 PM, George Pitcher
> <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > I have almost 30 websites that use PEAR::Mail to send emails on
> behalf of
> > users at universities (one site for each) to lecturers at the same
> > university.
> >
> > The problem I have is that if a lecturer sets an 'Out of Office' status,
> > it
> > gets bounced back to my server instead of to the user at the university.
> >
> > I did have the 'From' set to the user's email address, but that wasn't
> > very
> > successful ats it caused problems with the universities' anti-spam
> > systems.
> >
> > I've tried using ini_set('sendmail_from',$useremail); but that doesn't
> > seem
> > to work either.
> >
> > Can anyone point me in the right direction, please?
> >
> >
> > Cheers
> >
> > George in Edinburgh
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

--- End Message ---

Reply via email to