php-general Digest 27 Aug 2003 07:54:28 -0000 Issue 2261
Topics (messages 160847 through 160875):
Re: OO PHP question
160847 by: Ralph Guzman
Pipe an email to PHP
160848 by: Thomas Tremain
160860 by: Greg Donald
160873 by: Thomas Tremain
If empty don't display...
160849 by: Frank Keessen
Re: verifying sql INSERTs
160850 by: CPT John W. Holmes
Re: PHP Interview questions
160851 by: Gabriel Guzman
160856 by: Martin Towell
160857 by: Curt Zirzow
Re: Website templating schemes
160852 by: Joel Konkle-Parker
160853 by: Joel Konkle-Parker
speed of mail() on two servers
160854 by: David T-G
160867 by: Manuel Lemos
Re: Image Magick
160855 by: David T-G
Re: dynamical balancing text in two colums
160858 by: Miles Thompson
DOM setting encoding attribute
160859 by: Maciek Ruckgaber Bielecki
can pdf forms be used to submit data into db?
160861 by: Ryan.K.Look.courts.state.hi.us
can pdf forms be used to submit data into a db?
160862 by: Ryan.K.Look.courts.state.hi.us
Looping through a list - Newbie question
160863 by: James Johnson
160869 by: Jean-Christian IMbeault
Re: webserver for mac
160864 by: Joel Rees
dealing with arrays
160865 by: Aris Santillan
160871 by: Aris Santillan
SQL Query request is just hanging.
160866 by: Larry_Li.contractor.amat.com
Frames: how to get the url of the top frame?
160868 by: Jean-Christian IMbeault
Re: Cannot pass values from one page to another
160870 by: jabber.raditha.com
Sessions and frames
160872 by: Jean-Christian IMbeault
160875 by: Jean-Christian IMbeault
Re: pear problem
160874 by: Moritz Steiner
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 ---
http://www.php.net/oop
http://php.resourceindex.com/Documentation/Class_Design_and_OOP/
http://www.evolt.org/article/PHP_Intro_to_Objects_and_Classes/17/48911/i
ndex.html
-----Original Message-----
From: Mike Zornek [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 26, 2003 11:01 AM
To: [EMAIL PROTECTED]
Subject: [PHP] OO PHP question
I'm just beginning a new PHP system and would like to do it in an OO
way.
I'm having trouble getting my head around how I should store the data in
the
MySQL db. I mean do I build model objects in PHP and put logic right in
the
model so anytime I set a property of the object it makes the change to
the
DB right there and then (which may get chatty) or do I build model
objects
and then on pages, initialize them from the DB, do my work and send all
the
data to the db in one shot?
Everything I've done in PHP has been procedural till this point so I'm
up
for any advice, articles, links, etc.
~ Mike
--
Mike Zornek
Extreme geek in training
http://MikeZornek.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'm sure this question has been visited before, but I've had some troubles
searching through
the archives.
This is at least a two part question.
I wish to use a pipe instead of the pop3 class, because I wish the email to
start the script
instead of waiting for a cronjob.
1) The pipe itself:
On a cPanel server, I wish to setup an email address with a pipe like:
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> :
|/home/account/public_html/mailtools/emailscript.php
This always gives me an error saying it cannot foraward.
If I pipe it to "|/usr/bin/php
/home/account/public_html/mailtools/emailscript.php"
it tells me: "No input file specified."
2) to read the data:
I wish to parse the data into $from $subject and $body
The data will then be manipulated, and key pieces of data will be extracted
and sent to either a database or an instant message to my cell phone. (this
part I've already solved)
Thomas Tremain
www.LiveHost.net <http://www.LiveHost.net>
www.GotoNames.com <http://www.GotoNames.com>
www.TrafficExaminer.com <http://www.TrafficExaminer.com>
--- End Message ---
--- Begin Message ---
>
> I'm sure this question has been visited before, but I've had some troubles
> searching through
> the archives.
>
> This is at least a two part question.
>
> I wish to use a pipe instead of the pop3 class, because I wish the email to
> start the script
> instead of waiting for a cronjob.
>
> 1) The pipe itself:
> On a cPanel server, I wish to setup an email address with a pipe like:
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> :
> |/home/account/public_html/mailtools/emailscript.php
I would read the data from the pipe with STDIN:
$fp = fopen("php://stdin", "r");
while(!feof($fp)) $buffer .= fgets($fp, 4096);
fclose($fp);
> This always gives me an error saying it cannot foraward.
>
> If I pipe it to "|/usr/bin/php
> /home/account/public_html/mailtools/emailscript.php"
> it tells me: "No input file specified."
I use something like that in my .procmailrc:
:0 fw
| /usr/bin/spamassassin
:0
* ^X-Spam-Status: Yes
{
:0 c
| $HOME/.spamassassin/spamcop.php
:0
spam
}
--
Greg Donald
http://destiney.com/
--- End Message ---
--- Begin Message ---
I have attempted to create a .procmailrc that looks like:
:0
* [EMAIL PROTECTED]
| $HOME/emailtest.php
I have also removed the forwarder from my /etc/valiases file.
Now I get: The following address(es) failed: [EMAIL PROTECTED]
Can I be sure Procmail is even handling my email? I thought Exim and
MailScanner took care of that.
-----Original Message-----
From: Greg Donald [mailto:[EMAIL PROTECTED]
> This always gives me an error saying it cannot foraward.
>
> If I pipe it to "|/usr/bin/php
> /home/account/public_html/mailtools/emailscript.php"
> it tells me: "No input file specified."
I use something like that in my .procmailrc:
:0 fw
| /usr/bin/spamassassin
:0
* ^X-Spam-Status: Yes
{
:0 c
| $HOME/.spamassassin/spamcop.php
:0
spam
}
--
Greg Donald
http://destiney.com/
--- End Message ---
--- Begin Message ---
Hi there,
Can you please have a look at the following code:
I've got two questions;
1. I'm trying not to display the fields that are empty with: if
(!empty($row9->prijs4pk)){
But it's still display the line and there is no value in PRIJS4PK field.
2. How can i reduce the amount of Queries??
Thanks for your time and help,
Frank
The code:
<?
// Avaibility and prices
include("../conf/config.php");
include("../conf/functions.php");
// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
//Get ID
$id=$_GET['id'];
$page=$_GET['page'];
// limit value for number of records to be shown per page
// query database to find total number of records to display
$limit = 10;
$query_count = "SELECT date, prijs2pk, prijs1pk FROM date WHERE reisid = '$id'";
$result_count = mysql_query($query_count);
$totalrows = mysql_num_rows($result_count);
if(empty($page))
$page = 1;
$limitvalue = $page * $limit - ($limit);
$query = "SELECT date, prijs2pk, prijs1pk FROM date WHERE reisid = '$id' ORDER BY date
LIMIT $limitvalue, $limit ";
$result = mysql_query($query) or die("Error: " . mysql_error());
$count_result = mysql_num_rows($result);
$query2 = "SELECT date, prijs2pk, prijs1pk FROM date WHERE reisid = '$id' ORDER BY
date LIMIT $limitvalue, $limit ";
$result2 = mysql_query($query2) or die("Error: " . mysql_error());
$query3 = "SELECT date, prijs2pk, prijs1pk FROM date WHERE reisid = '$id' ORDER BY
date LIMIT $limitvalue, $limit ";
$result3 = mysql_query($query3) or die("Error: " . mysql_error());
$query5 = "SELECT date, prijs4pk, prijs3pk, prijs2pk, prijs1pk FROM date WHERE reisid
= '$id' ORDER BY date LIMIT $limitvalue, $limit ";
$result5 = mysql_query($query5) or die("Error: " . mysql_error());
$query6 = "SELECT date, prijs4pk, prijs3pk, prijs2pk, prijs1pk FROM date WHERE reisid
= '$id' ORDER BY date LIMIT $limitvalue, $limit ";
$result6 = mysql_query($query6) or die("Error: " . mysql_error());
$query4 = "SELECT naamreis FROM reizen WHERE reisid = '$id'";
$result4 = mysql_query($query4) or die("Error: " . mysql_error());
$row4 = mysql_fetch_object($result4);
$query9 = "SELECT totaalprijs, prijs4pk, prijs5pk, prijs3pk, prijs2pk, prijs1pk FROM
date WHERE reisid = '$id'";
$result9= mysql_query($query9) or die("Error: " . mysql_error());
$row9 = mysql_fetch_object($result9);
// Display links at the top to indicate current page and number of pages displayed
$numofpages = ceil($totalrows / $limit);
$from=$limit*$page-$limit+1;
$to=$from + $count_result-1;
?>
<html>
<head>
<link href="../css/main.css" rel="stylesheet" type="text/css">
</head>
<body>
<body bgcolor="#F2D071">
<?
echo "<font class=\"bold\">" . $row4->naamreis . "</font>";
?>
<br><br><TR bgColor=#ffcc00>
<TD colSpan=3 height=126>
<TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
<TBODY>
<TR>
<TD class=standaardwit width="14%" bgColor=#ff9900>
<DIV align=right></DIV></TD>
<?
if (mysql_num_rows($result) > 0)
{
while($row = mysql_fetch_object($result))
{
echo "<TD width=40 bgColor=#ffffff height=38><DIV align=right>".
formatDateShort($row->date) . "</DIV></TD>";
}
}
?>
</TR>
<?
if (!empty($row9->prijs4pk)){
?>
<TR>
<TD class=standaardwit width="14%" bgColor=#ff9900>
<DIV align=right>4 pk</DIV></TD>
<?
if (mysql_num_rows($result6) > 0)
{
while($row5= mysql_fetch_object($result5))
{
$pr6 = number_format($row5->prijs4pk,0);
echo "<TD class=standaard width=40 bgColor=#ffffff><DIV align=right>". $pr6 .
"</DIV></TD>";
}
}
}
if (!empty($row99->prijs3pk)){
?>
<TR>
<TD class=standaardwit width="14%" bgColor=#ff9900>
<DIV align=right>3 pk</DIV></TD>
<?
if (mysql_num_rows($result5) > 0)
{
while($row5= mysql_fetch_object($result5))
{
$pr5 = number_format($row5->prijs3pk,0);
echo "<TD class=standaard width=40 bgColor=#ffffff><DIV align=right>". $pr5 .
"</DIV></TD>";
}
}
}
if (!empty($row9->prijs2pk)){
?>
<TR>
<TD class=standaardwit width="14%" bgColor=#ff9900>
<DIV align=right>2 pk</DIV></TD>
<?
if (mysql_num_rows($result2) > 0)
{
while($row2= mysql_fetch_object($result2))
{
$pr2 = number_format($row2->prijs2pk,0);
echo "<TD class=standaard width=40 bgColor=#ffffff><DIV align=right>". $pr2 .
"</DIV></TD>";
}
}
}
?>
<?
if (!empty($row9->prijs1pk)){
?>
<TR>
<TD class=standaardwit width="14%" bgColor=#ff9900>
<DIV align=right>1 pk</DIV></TD>
<?
if (mysql_num_rows($result3) > 0)
{
while($row3= mysql_fetch_object($result3))
{
$pr1 = number_format($row3->prijs1pk,0);
echo "<TD class=standaard width=40 bgColor=#ffffff><DIV align=right>". $pr1 .
"</DIV></TD>";
}
}
}
// start 123 next>> table
echo "<table align=\"center\" width=\"90%\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0\">
<tr><td width=\"50%\" bgcolor=\"$bg_colour\"
align=\"left\">";if($numofpages>1){echo"</td><td width=\"50%\" bgcolor=\"$bg_colour\"
align=\"right\"><b></b> ";}
// display previous link if page is not 1
if($page != 1){
$pageprev = $page - 1;
echo("<a href=\"$PHP_SELF?id=$id&page=$pageprev&search=$search\"><< Terug</a> ");
}
// display page nos if not 1
for($i = 1; $i <= $numofpages; $i++){
if($numofpages>1){
if($i == $page)
echo(" ".$i." ");
else
echo(" <a href=\"$PHP_SELF?id=$id&page=$i&search=$search\">$i</a> ");
}}
// display next page link if there is more than one
if(($totalrows - ($limit * $page)) > 0){
$pagenext = $page + 1;
echo("<a href=\"$PHP_SELF?id=$id&page=$pagenext&search=$search\">Volgende >></a>");
}
// end 123 next>> table
echo"</td></tr></table><br>";
?>
</TR> </TBODY></TABLE></TD></TR></html>
--- End Message ---
--- Begin Message ---
From: "Curt Zirzow" <[EMAIL PROTECTED]>
> > I should instead just try to perform the INSERT and then if it fails I
> > know I've already got a record. If it doesn't I know everything is cool.
>
> I've debated with myself several times if this is really a good
> method to not have duplicates in the database.
>
> Like what happens if for some reason the constraint gets dropped?
> having your progam rely on the constraint will cause all data
> integrity to go to hell.
For one little script inserting into it's own little table, yeah, it really
doesn't matter.
Consider, though, a business making use of this database not only through a
PHP script, but through an Access frontend in marketing, some ASP scripts in
HR, etc. Now, if you don't enforce the constraints in the database, each and
every program must enforce the constraits itself. It's easier to do it in
one place. :)
---John Holmes...
--- End Message ---
--- Begin Message ---
On Tue, 2003-08-26 at 11:35, Curt Zirzow wrote:
> * Thus wrote Richard Baskett ([EMAIL PROTECTED]):
> > on 8/26/03 9:57 AM, Robert Cummings at [EMAIL PROTECTED] wrote:
> >
> > > This smells like a trick question... Are the switches connected to the
> > > same light bulb? You've only mentioned one light bulb? 8)
> > >
> > > Cheers,
> > > Rob.
> > >
> > >
> > > On Tue, 2003-08-26 at 12:35, Jay Blanchard wrote:
> > >> Also ask a couple of other questions that require thought, but have
> > >> nothing else to do with code. such as...
> > >>
> > >> In one room you have 3 light switches, each connected to one light bulb
> > >> in another room. How many trips must you make to determine which switch
> > >> is connected to which light bulb?
> >
> > Only one trip, and Im not sure if I should explain or let you guys figure it
> > out :)
>
> toggle_light(1);
> sleep(120);
> toggle_light(1);
>
> toggle_light(2);
> move('self', 'room/');
>
> if ($lightbulb['temp'] > $room['temp']) {
> echo "switch #1";
> } elseif ($lightbulb['ison']) {
> echo "switch #2";
> } else {
> echo "switch #3";
> }
>
unfortunately, this won't work... you need to loop through the
lightbulbs...
try something like:
foreach ($lightbulbs as $bulb){
}
and your if else logic needs a little tweaking so you don't incorrectly
label the "on" lightbulb as being switch #1 since it is also greater
than $temp['room']
see the following manual pages:
http://us4.php.net/manual/en/control-structures.foreach.php
http://us4.php.net/manual/en/thelightbulb-determination-problem.php
http://us4.php.net/manual/en/i-have-too-much-time-on-my-hands.php
</joking>
gabe.
--- End Message ---
--- Begin Message ---
Just to throw a spanner (where'd that come from, that wasn't part of the
question) into the works...
What is the state of the light bulb before the test?
If it's on and it's connected to switch #1, then the logic below would
result in "switch #2" being displayed... (maybe.., I don't know how long it
takes for a light bulb to cool down)
Martin
-----Original Message-----
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 27 August 2003 5:35 AM
To: Curt Zirzow; PHP General
Subject: Re: [PHP] PHP Interview questions
From: "Curt Zirzow" <[EMAIL PROTECTED]>
> toggle_light(1);
> sleep(120);
> toggle_light(1);
>
> toggle_light(2);
> move('self', 'room/');
>
> if ($lightbulb['temp'] > $room['temp']) {
> echo "switch #1";
> } elseif ($lightbulb['ison']) {
> echo "switch #2";
> } else {
> echo "switch #3";
> }
>
> hm.. i had to keep it OT somehow :)
Aren't you missing a foreach($lightbulb as $bulb) in there somewhere?
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________ Information from NOD32 1.490 (20030820) __________
This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com
--- End Message ---
--- Begin Message ---
* Thus wrote Gabriel Guzman ([EMAIL PROTECTED]):
> On Tue, 2003-08-26 at 11:35, Curt Zirzow wrote:
> > * Thus wrote Richard Baskett ([EMAIL PROTECTED]):
> > > on 8/26/03 9:57 AM, Robert Cummings at [EMAIL PROTECTED] wrote:
>
> unfortunately, this won't work... you need to loop through the
> lightbulbs...
>
> try something like:
>
> foreach ($lightbulbs as $bulb){
Only one light bulb from how I originally read it. Multiple light
bulbs will be supported in the next version.
>
> http://us4.php.net/manual/en/i-have-too-much-time-on-my-hands.php
According to this manual I have to supply this patch to make the program
work properly:
*** lightbulb.php Tue Aug 26 23:21:10 2003
--- lightbulb.fix.php Tue Aug 26 23:21:51 2003
***************
*** 7,12 ****
! if ($lightbulb['temp'] > $room['temp']) {
! echo "switch #1";
! } elseif ($lightbulb['ison']) {
echo "switch #2";
} else {
--- 7,12 ----
! if ($lightbulb['ison']) {
echo "switch #2";
+ } elseif ($lightbulb['temp'] > $room['temp']) {
+ echo "switch #1";
} else {
>
> </joking>
Cheers!
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
Quoting "Chris W. Parker" <[EMAIL PROTECTED]>:
> And I completely don't understand Option #2. What does body() do and
> why
> do you call it? Can you show some pseudo code to help us (or maybe
> it's
> just me) understand how Option #2 works?
Browser calls index.php
--
#index.php
programming tasks......
$results = results of above;
function body() {
# info, content, etc.
global $results;
echo $results;
}
require "template.php";
--
--
#template.php
prints header stuff....
body();
prints footer stuff....
--
Does that make any sense?
--
Joel Konkle-Parker
Webmaster [Ballsome.com]
Phone [662-518-1636]
E-mail [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
> With method 2 it seems like your template file would become redundant
> because every one of them would have to contain the header and footer
> code.
>
> I would use 3 template files, header.php, footer.php, and
> body_index.php
>
> index.php would:
>
> 1. PERFORM LOGIC
> 2. include header
> 3. include body
> 4. include footer
>
> Then, all you have to do is make new body_XXX.php files for each page
> on
> your site and the header/footer content is contained in one place.
Ok, wait, I'm having a hard time understanding this... the browser would request
the same index.php every time? with server.com/index.php?query_string? And the
query string would determine the body_XXX.php to be included?
Right now I have it set up so that a different index.php is requested each time,
but calls the same template.php.
--
Joel Konkle-Parker
Webmaster [Ballsome.com]
Phone [662-518-1636]
E-mail [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hi, all --
I'm working up a [cli] script to send a personalized (ugh) email to some
[often large] number of web site subscribers. Unfortunately, I'm getting
lousy performance, running about 0.54 sec per email.
My partner has a mail script implemented on another machine and he's
running somewhere down around 0.10 sec per email, which is better but
still not very good for sending to 60k users.
The box (dual Xeon 2.2G with mirrored fast SCSI and 1G RAM) has plenty of
horsepower, and it certainly shouldn't need more. It's running RH 7.3
(Valhalla) with 2.4.20 on ext3 and has qmail installed as its MTA.
It seems to be the mail() call itself, because I can make a system call
(system, exec, passthru) to just echo the current data and it rips
through my list in nothin' flat. So how do I tune mail() to make it
faster? Or do I need to give up and call qmail-inject directly?
TIA & HAND
:-D
--
David T-G * There is too much animal courage in
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
pgp00000.pgp
Description: PGP signature
--- End Message ---
--- Begin Message ---
Hello,
On 08/26/2003 07:39 PM, David T-G wrote:
I'm working up a [cli] script to send a personalized (ugh) email to some
[often large] number of web site subscribers. Unfortunately, I'm getting
lousy performance, running about 0.54 sec per email.
My partner has a mail script implemented on another machine and he's
running somewhere down around 0.10 sec per email, which is better but
still not very good for sending to 60k users.
The box (dual Xeon 2.2G with mirrored fast SCSI and 1G RAM) has plenty of
horsepower, and it certainly shouldn't need more. It's running RH 7.3
(Valhalla) with 2.4.20 on ext3 and has qmail installed as its MTA.
It seems to be the mail() call itself, because I can make a system call
(system, exec, passthru) to just echo the current data and it rips
through my list in nothin' flat. So how do I tune mail() to make it
faster? Or do I need to give up and call qmail-inject directly?
I think your bottleneck is not in the queuing but rather in the
composition of the personalized messages and the actual delivery.
As for the personalization, you should ask if you really need it. What
do you need it for?
For the delivery, you can always tune qmail to try deliverying messages
to more recipients at the same time tweaking concurrencyremote option.
The default it 20 recipients at the same time but you can increase it to
120 without patches.
--
Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--- End Message ---
--- Begin Message ---
Mike --
...and then Mike At Spy said...
%
% Anyone here familiar with the installation of Image Magick and what files it
% installs on your machine?
Yep.
%
% I had an admin put it on, and then took it off - but took it off by removing
Why take it off? Tsk, tsk! You'll miss it ;-)
% what she thought were all of the files related to it. I just found some
% files I think that are. They are located in the usr/local/bin directory and
% are called:
%
% animate
% composite
% convert
% display
% identify
% mogrify
% montage
Yes, those are all magick executables. The interesting thing is that
your admin could have missed those when, well, they're the biggest end
result of IM (some might just use the perl or lib code, but most will
want the CLI executables). I wouldn't be at all sure that "everything
else" has been cleaned from the machine. You might run a find across the
whole system and check for that timestamp.
As was already suggested, if it was installed via rpm then go ahead and
remove it via rpm.
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
pgp00001.pgp
Description: PGP signature
--- End Message ---
--- Begin Message ---
We tried something like this in the spring. If the paragraphs are uniform
in length you can get columns roughly balanced - but never with a high
degree of certainty.
We also knew our subscribers would be printing out the copy, and that's
where we gave up on two column layout, as we had no control over the sheet
size, font size, etc. If an article extended over two pages, you had to
read the first colum to the bottom, turn the page and keep reading to the
end of the column, then flip back and start reading the second column.
I suppose one could get closer, but look at the desktop publishing programs
- apart from FrameMaker, you have to flow and place text by hand. To do it
we'd be counting lines, adjusting for heads and bylines, and hoping,
hoping, hoping it would not look too disgraceful.
So we bailed out - the subscriber could read it online, with a decent line
lenght in a Flash movie, or accept "typewriter like" printout extending
across the page. What made that decision easier was a survey which
indicated that over 90% of subscribers read it on line and did not print it.
Cheers - Miles Thompson
At 07:10 PM 8/26/2003 +0200, Dynamical.biz wrote:
Hi, I've been dealing withs this question:
I've never seen dynamical balanced text in two colums in a web so this the
challenge.
html formated text is stored in a database, conetion and placed into a
variable i.e.:
$text = "<P><IMG alt="labordeta" hspace=3
src="http://www.lamundial.net/img/labordeta.jpg" align=left
border=0><EM>efe.Zaragoza.</EM> El parlamentario.</P><P>Some more text
tranquilo simplenente trabajando.</P>"; ... some more paragrphs just like
newspaper articles.
the first idea is this:
1. count the total characters in $text string so we can guess juts the half
2. getting into $tx1 variable the fisrt half
3. count the total characters in $tx1 till the fisrt "</p>" STARTING from
the END to the BEGUINING of $tx1
4. getting into $col1 the fist part
5. getting into $col2 the rest
6. render the text in a table
//CODE
1. $half = floor(strlen($texto)/2);
2. $tx1 = substr($text,0,$half);
3. $first_P = strrpos($tx1,"</P>");
4. $col1 = substr($text,0,$first_P);
5. $col2 = substr($text,$first_P);
6.
<table>
<tr>
<td><?= $col1 ?></td>
<td><?= $col2 ?></td>
</tr>
</table>
PROBLEMS
easy to know the middle point of a string but we have html code so easy to
break it badly, something like:
<IMG hspace=3 src="ht <-|-> tp://www.lamundial.net/img/img.jpg"> so this is
why the </p> idea.
If there is a large paragrph in the middle of the whole text the columns the
two columns are not so nice balanced, this is why I ask the people writing
articles for my web trying to avoid looooong ones. They use HTMLAREA
http://www.interactivetools.com/products/htmlarea/ from Interactive tools so
the html is not done by hand.
anyway just in case there is no way to correctly balance the text I let the
writer the "1 colum / 2 colums" as an option so the traditional 1 colum (no
colums) is always available. they can display the final render os the
article as they save it when writing so the decide.
this is working at most of the articles in
http://www.lamundial.net
i.e.:
http://www.lamundial.net/home.php?pg=article&idart=124
http://www.lamundial.net/home.php?pg=article&idart=121
http://www.lamundial.net/home.php?pg=article&idart=118
the text balancing is working quite nice
any other idea?
thanks
aniceto lópez
DYNAMICAL.BIZ
web development
host services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi there everybody !!
i have been trying to set the encoding attribute in the
<?xml version="1.0"?> document definition, using the DOM model
any idea about some info ???
Thanks in advance!!!
--
Maciek Ruckgaber Bielecki
--- End Message ---
--- Begin Message ---
hi guys and gals, aloha from hawaii,
Not sure if this is the right place to ask, but i just need to know if it
is technically possible to have a pdf form be filled out online and then
once the user hits submit, php takes the data and puts it into a db or some
sort of db technology and if the need arises to pull up that record once
more, php fetches the data from the db and dynamically fills out the pdf
form and presents it to the end user...can do? or anyone know who i can
talk to about this...
thanks and mahalo from hawaii
<incentive>
if anyone can help me or point me in the right direction, i MAY be inclined
to send some macadamia nuts to the continental US
</incentive>
--- End Message ---
--- Begin Message ---
hi guys and gals, aloha from hawaii,
Not sure if this is the right place to ask, but i just need to know if it
is technically possible to have a pdf form be filled out online and then
once the user hits submit, php takes the data and puts it into a db or some
sort of db technology and if the need arises to pull up that record once
more, php fetches the data from the db and dynamically fills out the pdf
form and presents it to the end user...can do? or anyone know who i can
talk to about this...
thanks and mahalo from hawaii
<incentive>
if anyone can help me or point me in the right direction, i MAY be inclined
to send some macadamia nuts to the continental US
</incentive>
--- End Message ---
--- Begin Message ---
Hi,
I have a list contained in a session var. I want to loop through the list,
getting the value of the current item, then do a query based on that value.
Is there an easy way to do this, or do I need to convert the list to an
array first? In the code below, $id isn't being set.
Here's my code (this is just testing stuff, sv_CampusList is set somewhere
else):
<?php
session_start();
$_SESSION['sv_CampusList'] = "1,2,4,5";
for($i=1; $i<=strlen($_SESSION['sv_CampusList']); $i++){
$id = strpos($_SESSION['sv_CampusList'],$i);
echo $id;
}
?>
Thanks,
James
--- End Message ---
--- Begin Message ---
explode() and then foreach are your friends :)
explode() using the comma as your separator and then traverse the array
using foreach.
Jean-Christian Imbeault
James Johnson wrote:
--- End Message ---
--- Begin Message ---
> I am doing some php work for a local company who uses a mac. I was telling
> them that I use apache as my webserver and they want to know what they can
> use as their webserver. I know nothing about Macs and don't think you an
> run apache but I may be all wrong...what do mac owners use for a webserver?
_A_ mac? Do I sense the fragrance of ancient hardware?
First place you want to look is apple.com. After reading the white pages
on Mac OS X and Mac OS X Server, you really should plug "apple web
server" and "macintosh web server" and other variants into your favorite
search site and look around. You might even run into the fact that a Mac
(pre-Mac OS X) was once considered practically impenetrable. (I don't
remember if that challenge was ever defeated, the industry just seems to
have moved on.)
More information than you probably want:
Mac OSses 8 and 9 have a personal web server built it. There are also
freeware/shareware servers available that will run on Mac OSses 7 and 8.
There are some commercial webservers, as well, some of which are being
maintained and updated for Mac OS X, one has already been mentioned.
I know of a live site being maintained professionally, serving FileMaker
files on the web with the personal web server under Mac OS 8.6. It's a
low-traffic site, of course.
I think there's still an SE running System 6 and serving (hobby) web
pages somewhere out there, too, just to show it can be done. Haven't
looked for a while.
But you should understand that the Mac OS previous to Mac OS X was
cooperative multitasking, and it was difficult to serve multiple
requests simultaneously on those machines.
<on-topic>
It'd surprise me if you could serve php on a pre-Mac OS X machine, but
you can definitely serve perl (MacPerl) on them. As the others have said,
I'd recommend Mac OS X for your customer, for a couple of reasons:
First, php is already installed, or, at least, it was there on Mac OS X
10.2 when I got my copy of that. It needs to be updated for security
reasons, but it is already in place. All I did was uncomment a couple of
lines in httpd.conf and I was testing php pages on my iBook. (Perl is
there, too, of course. Perl 5.8 will probably make it into Panther. Java
is also there, and installing Tomcat/Struts, and the like is not all
that hard.)
Second, unless you need to build an absolutely impenetrable site, you
and your customer will prefer to have the full Unix-family OS underlying
Mac OS X. (Mac OS X is pretty secure, too, anyway. If you need more than
that, you might want to look at openbsd, which, incidentally, does run
on some Mac hardware.)
Third, your customer really doesn't want to serve their site on a box
that is also being used to run applications. So, even if the box they
are thinking of putting the site on isn't a Mac OS X box, they really
want another box, and they might as well get Mac OS X for that box.
</on-topic>
--
Joel Rees, programmer, Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp
--- End Message ---
--- Begin Message ---
hi
I Have
<p>Entry One
<input type=text name=name[]>
<input type=text name=tel[]>
<input type=checkbox name=check[] value=1>
<p>Entry Two
<input type=text name=name[]>
<input type=text name=tel[]>
<input type=checkbox name=check[] value=1>
<p>Entry Three
<input type=text name=name[]>
<input type=text name=tel[]>
<input type=checkbox name=check[] value=1>
<p>Entry Four
<input type=text name=name[]>
<input type=text name=tel[]>
<input type=checkbox name=check[] value=1>
<p>Entry Five
<input type=text name=name[]>
<input type=text name=tel[]>
<input type=checkbox name=check[] value=1>
.
i want to process entries only with checked checkbox
how can i do this in php?
--- End Message ---
--- Begin Message ---
> hi
>
>
> I Have
> <p>Entry One
> <input type=text name=name[]>
> <input type=text name=tel[]>
> <input type=checkbox name=check[] value=1>
>
> <p>Entry Two
> <input type=text name=name[]>
> <input type=text name=tel[]>
> <input type=checkbox name=check[] value=1>
>
> <p>Entry Three
> <input type=text name=name[]>
> <input type=text name=tel[]>
> <input type=checkbox name=check[] value=1>
>
> <p>Entry Four
> <input type=text name=name[]>
> <input type=text name=tel[]>
> <input type=checkbox name=check[] value=1>
>
> <p>Entry Five
> <input type=text name=name[]>
> <input type=text name=tel[]>
> <input type=checkbox name=check[] value=1>
>
> .
>
> i want to process entries only with checked checkbox
>
> how can i do this in php?
>
--- End Message ---
--- Begin Message ---
I'm using IIS5.0 on W2k. I have upgraded w2k to sp4 and ms sql server to
sp3. I created a new table and just do a simple query in php program. But
it seems sql server doesn't return any query result. I'm using
mssql_fetch_array() function, but no any return. PHP program is just
pending there. I checked process info and found wait type is NETWORKIO. No
problem for other existing queries. Only this new one. Almost got
crazy....
Any idea, Thanks a lot!
Larry
--- End Message ---
--- Begin Message ---
I am providing content for an other site. My content is getting shown in
side a frame. My content contains links to other content I provide. It
also has forms that the user can use to submit information.
The form's submit action depends on some information that the main site
send to me in the url, i.e., http://bigsite.com/index.html?submit=actionName
The problem is that cannot find a way to access the URL form inside the
frame. All the $_SERVER vars are relative to my frame.
Is there a way for me to access the top (parent?) frame's URL?
Thanks,
Jean-Christian Imbeault
--- End Message ---
--- Begin Message ---
Hi,
Ok this is a major vulnerability that you are coding. Register globals
on and password being stored in the session is like having a banner on
your home page saying 'come and hack me'.
murugesan wrote:
My register_globals in set to ON in php.ini file.
I cannot use HTTP_COOKIE_VARS because I need to pass the password from one
page to another.
-murugesan
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "php mailing list" <[EMAIL PROTECTED]>
Sent: Tuesday, August 26, 2003 7:13 PM
Subject: Re: [PHP] Cannot pass values from one page to another
what's your register globals settings?
did you try to retrieve from HTTP_COOKIE_VARS ?
murugesan wrote:
Thanks for the message.
I looked into the manual.
But it is not working.
Ofcourse I used session_start in every pages.
-murugesan
----- Original Message -----
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "murugesan" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, August 26, 2003 5:23 PM
Subject: RE: [PHP] Cannot pass values from one page to another
[snip]
I got this value in next page(main.php)
But from there I am not able to pass it to next page
I used
session_register('uid');
in main.php
but in next page $uid is returning null
[/snip]
First, look at the manual for sessions. You have posted many questions
where the manual would have provided you a solution.
Are you placing session_start() at the top of each page where you expect
session variables to be available? You should be...
Have a pleasant day.
--
http://www.raditha.com/php/progress.php
A progress bar for PHP file uploads.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
http://www.raditha.com/php/progress.php
A progress bar for PHP file uploads.
--- End Message ---
--- Begin Message ---
I'm having problems getting a session to start when my script is loaded
in a frame.
I provide some content that another web site loads up in a frame. I have
set session.autostart to true in my php.ini file so that sessions are
always started automatically and use cookies. The problem is that when a
user clicks on any links in my first page a new session is started, the
current one is not used.
I try and set some session vars using the following on my first page:
<?php
$_SESSION["a"] = "a";
$_SESSION["b"] = "b";
echo "<a href='index.html'>Click Here</a>";
?>
After this page loads in a frame I look at the /tmp dir on my server and
I can see that a session file has been created and contains the correct
values.
However if I click the link (which is just a link to the same page), a
new session is started. I.e. if I look in /tmp I now see 2 session files
and the newer one is empty. If I reclick on the link the new session is
used and the the session vars are properly set.
The problem is that the first session that is created is not used.
clicking on links in my frame (which go to other pages on my server)
causes a new session to be started and the original session to be
forgotten. The second session is then correctly kept across pages.
Why is my first session not kept? I'm a bit confused. Could it have
anything to do with the fact that the site that is using my content is
also setting a cookie?
Thanks,
Jean-Christian Imbeault
--- End Message ---
--- Begin Message ---
A little update, seems I was wrong about the session cookie being set
when the page is first access. The first time the page is accessed no
session cookie or /tmp file is generated. I think this may be because
the site that is loading my content in a frame is also generating a cookie.
Is that a probable cause for my problem? If yes (or) how can I get a
session to be started (using cookies) when my content is loaded into a
frame?
Thanks,
Jc
--- End Message ---
--- Begin Message ---
Hi,
yes, the directory the /usr/php/pear/share/pear is included, the error message is:
Warning: main(PEAR.php): failed to open stream: No such file or directory in
/usr/php/pear/share/pear/SOAP/Base.php on line 37
Fatal error: main(): Failed opening required 'PEAR.php'
(include_path='/usr/php/pear/share/pear') in /usr/php/pear/share/pear/SOAP/Base.php on
line 37
Moritz
-----Ursprüngliche Nachricht-----
Von: Catalin Trifu [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 26. August 2003 16:53
An: [EMAIL PROTECTED]
Betreff: [PHP] Re: pear problem
Hi,
Did you added the /usr/php/pear/share/pear in the php.ini
include_path option ?
Besides the mime is part of Mail_Mime extension and
SOAP needs some extensions too (don't remember exactly which)
so check if all requirements are met.
btw! what's the error message when it crashes ?
Cheers,
Catalin
"Moritz Steiner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I've a problem with pear, only the DB.php and the Mail.php are working,
all the others I installed don't work.
Installed packages:
===================
Package Version State
DB 1.5.0RC1 stable
HTTP_Request 1.1.1 stable
Mail 1.1.1 stable
Mail_Mime 1.2.1 stable
Net_DIME 0.3 beta
Net_URL 1.0.10 stable
SOAP 0.8RC1 beta
When I have a look into the directory, it's like that:
[lxcmsb3] /usr/php/pear/share/pear > l
total 72
drwxr-xr-x 6 root root 4096 Aug 26 16:24 SOAP
drwxr-xr-x 6 root root 4096 Aug 26 16:24 docs
drwxr-xr-x 2 root root 4096 Aug 26 16:24 HTTP
drwxr-xr-x 2 root root 4096 Aug 26 16:24 Net
drwxr-xr-x 4 root root 4096 Aug 26 16:24 tests
drwxr-xr-x 2 root root 4096 Aug 26 16:24 Mail
drwxr-xr-x 3 root root 4096 Aug 26 16:24 data
-rw-r--r-- 1 root root 7331 Aug 26 16:23 Mail.php
drwxr-xr-x 2 root root 4096 Aug 26 16:23 DB
-rw-r--r-- 1 root root 29165 Aug 26 16:23 DB.php
In this code snipplet the first three lines work very well, but when I
try to access a subdirectory it crashes...
1 require 'DB.php';
2 $db = DB::connect('mysql://mysql:[EMAIL PROTECTED]/mysql);
3 require 'Mail.php';
4 require 'Mail/mime.php';
It's exactly the same with require 'SOAP/Client.php' instead of line 4
Please help me.
Moritz
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---