need help with generating html source from the php

need help with generating html source from the php

am 26.09.2007 19:53:43 von shror

Hi every body,

I need your help in a problem am facing,
I have two forms on my website which when submitted they goto single
page (confirmation.php) and the two forms are for English and Arabic
versions and what I want to do is to create a single confirmation page
which is responsible to send the forms values.
What I want to do is that when the arabic form is submitted the
confirmation echos arabic succesful note and when english an english
successful note is echoed which is easy to do but my problem is that
the section of the confirmation contains a redirection meta tag
for the home page and I want the meta tag to be generated according to
the language interface, and I dont know how to generate HTML using the
php so please if anybody could help me this will be really
appreciated.
or even to direct me to a tutorial for this situation.

Thanks for help in advance

shror

Re: need help with generating html source from the php

am 26.09.2007 21:21:12 von Macca

Me thinks you need to read up a bit on php. Try http://w3schools.com/php/default.asp

$language = 'Arabic';

if ($language == 'Arabic'){

echo "Some HTML and Arabic stuff";

} elseif ($language == 'English'){

echo "Some HTML and English stuff";

} else {

echo "You must choose a Language";

}

Regards,

Paul

Re: need help with generating html source from the php

am 26.09.2007 21:30:52 von Jerry Stuckle

shror wrote:
> Hi every body,
>
> I need your help in a problem am facing,
> I have two forms on my website which when submitted they goto single
> page (confirmation.php) and the two forms are for English and Arabic
> versions and what I want to do is to create a single confirmation page
> which is responsible to send the forms values.
> What I want to do is that when the arabic form is submitted the
> confirmation echos arabic succesful note and when english an english
> successful note is echoed which is easy to do but my problem is that
> the section of the confirmation contains a redirection meta tag
> for the home page and I want the meta tag to be generated according to
> the language interface, and I dont know how to generate HTML using the
> php so please if anybody could help me this will be really
> appreciated.
> or even to direct me to a tutorial for this situation.
>
> Thanks for help in advance
>
> shror
>

echo "This text is bold\n";
?>


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: need help with generating html source from the php

am 27.09.2007 09:03:56 von shror

On Sep 26, 10:30 pm, Jerry Stuckle wrote:
> shror wrote:
> > Hi every body,
>
> > I need your help in a problem am facing,
> > I have two forms on my website which when submitted they goto single
> > page (confirmation.php) and the two forms are for English and Arabic
> > versions and what I want to do is to create a single confirmation page
> > which is responsible to send the forms values.
> > What I want to do is that when the arabic form is submitted the
> > confirmation echos arabic succesful note and when english an english
> > successful note is echoed which is easy to do but my problem is that
> > the section of the confirmation contains a redirection meta tag
> > for the home page and I want the meta tag to be generated according to
> > the language interface, and I dont know how to generate HTML using the
> > php so please if anybody could help me this will be really
> > appreciated.
> > or even to direct me to a tutorial for this situation.
>
> > Thanks for help in advance
>
> > shror
>
> > echo "This text is bold\n";
> ?>
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

I read about php on w3schools but the problem is that what I
understood is that the echo is used t echo something to the user to
read so that if I used

$language = 'Arabic';
if ($language == 'Arabic'){
echo "Some HTML and Arabic stuff";
} elseif ($language == 'English'){
echo "Some HTML and English stuff";
} else {
echo "You must choose a Language";
}

then I get on the page:
Some HTML and English stuff

anyway thanks for your help every body

shror

Re: need help with generating html source from the php

am 27.09.2007 09:14:14 von shror

On Sep 26, 10:21 pm, macca wrote:
> Me thinks you need to read up a bit on php. Tryhttp://w3schools.com/php/default.asp
>
> $language = 'Arabic';
>
> if ($language == 'Arabic'){
>
> echo "Some HTML and Arabic stuff";
>
> } elseif ($language == 'English'){
>
> echo "Some HTML and English stuff";
>
> } else {
>
> echo "You must choose a Language";
>
> }
>
> Regards,
>
> Paul

I tried your example Paul and It worked great I really feel as dumb
but I have a small problem I don't know why it happened, I have
created a page using notepad and saved it .php and Unicode, but when I
tested it online it was not working so I Saved it as ANSI and tested
it once more and the code worked correctly why is this happening

Thanks for help in advance and the previous help too

shror

Re: need help with generating html source from the php

am 27.09.2007 14:07:35 von Bucky Kaufman

"shror" wrote in message
news:1190829223.398719.48620@22g2000hsm.googlegroups.com...
> Hi every body,
>
> I need your help in a problem am facing,
> I have two forms on my website which when submitted they goto single
> page (confirmation.php) and the two forms are for English and Arabic
> versions and what I want to do is to create a single confirmation page
> which is responsible to send the forms values.

> What I want to do is that when the arabic form is submitted the
> confirmation echos arabic succesful note and when english an english
> successful note is echoed which is easy to do but my problem is that
> the section of the confirmation contains a redirection meta tag
> for the home page and I want the meta tag to be generated according to
> the language interface, and I dont know how to generate HTML using the
> php so please if anybody could help me this will be really
> appreciated.
> or even to direct me to a tutorial for this situation.

That's difficult to impossible to say - without seeing the code.
I think it boils down to one comment - "I don't know how to generate HTML".

You could probably resolve your issue by finding the place in the code where
the META tag is generated and then to use a conditional (if-the-else) to
generate the appropriate line.

Re: need help with generating html source from the php

am 27.09.2007 14:56:46 von Jerry Stuckle

shror wrote:
> On Sep 26, 10:21 pm, macca wrote:
>> Me thinks you need to read up a bit on php. Tryhttp://w3schools.com/php/default.asp
>>
>> $language = 'Arabic';
>>
>> if ($language == 'Arabic'){
>>
>> echo "Some HTML and Arabic stuff";
>>
>> } elseif ($language == 'English'){
>>
>> echo "Some HTML and English stuff";
>>
>> } else {
>>
>> echo "You must choose a Language";
>>
>> }
>>
>> Regards,
>>
>> Paul
>
> I tried your example Paul and It worked great I really feel as dumb
> but I have a small problem I don't know why it happened, I have
> created a page using notepad and saved it .php and Unicode, but when I
> tested it online it was not working so I Saved it as ANSI and tested
> it once more and the code worked correctly why is this happening
>
> Thanks for help in advance and the previous help too
>
> shror
>

Maybe because PHP is an ANSI language?

You don't need to save a file as unicode to send unicode to the browser.
And, in fact, if you do, you'll get other problems.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: need help with generating html source from the php

am 27.09.2007 15:08:01 von Shelly

"Sanders Kaufman" wrote in message
news:82NKi.37169$RX.8150@newssvr11.news.prodigy.net...
> "shror" wrote in message
> news:1190829223.398719.48620@22g2000hsm.googlegroups.com...
>> Hi every body,
>>
>> I need your help in a problem am facing,
>> I have two forms on my website which when submitted they goto single
>> page (confirmation.php) and the two forms are for English and Arabic
>> versions and what I want to do is to create a single confirmation page
>> which is responsible to send the forms values.
>
>> What I want to do is that when the arabic form is submitted the
>> confirmation echos arabic succesful note and when english an english
>> successful note is echoed which is easy to do but my problem is that
>> the section of the confirmation contains a redirection meta tag
>> for the home page and I want the meta tag to be generated according to
>> the language interface, and I dont know how to generate HTML using the
>> php so please if anybody could help me this will be really
>> appreciated.
>> or even to direct me to a tutorial for this situation.
>
> That's difficult to impossible to say - without seeing the code.
> I think it boils down to one comment - "I don't know how to generate
> HTML".
>
> You could probably resolve your issue by finding the place in the code
> where the META tag is generated and then to use a conditional
> (if-the-else) to generate the appropriate line.

An interesting question occurred to me. Using the if statement outlined
previously in this thread, what happens with the echo when the desired
language reads from right to left and not left to right? Is it simply that
the entire string is captured in the quotes and so appears on the screen as
right to left? If that is the case, then what happens with word wrap?
Wouldn't it then break at the beginning of the sentence rather than in the
middle? (I have only worked on English sites).

Shelly

Re: need help with generating html source from the php

am 27.09.2007 16:23:21 von Bucky Kaufman

"Shelly" wrote in message
news:13fnapid7bhrdb9@corp.supernews.com...
> "Sanders Kaufman" wrote in message

>> You could probably resolve your issue by finding the place in the code
>> where the META tag is generated and then to use a conditional
>> (if-the-else) to generate the appropriate line.
>
> An interesting question occurred to me. Using the if statement outlined
> previously in this thread, what happens with the echo when the desired
> language reads from right to left and not left to right?

I tend to buffer my echos until a block is fully composed.
I think there's a bunch of "ob****" stuff in PHP for that, but I just use a
variable.

Thus, the answer to your question is to do it like this:
[code]
if($sLanguage == "english"){
$sMessage = "Good God, almighty!";
} else {
$sMessage = "Allah akbar!";
}
echo $sMessage;
[/code]


> Is it simply that the entire string is captured in the quotes and so
> appears on the screen as right to left? If that is the case, then what
> happens with word wrap?

I don't understand the question.
You had me up until word-wrap.
When you echo a string, as shown - it spits the result out to std_out as
composed.
There's no word-wrap unless the client is doing something like that.
Does that help answer the question?


> Wouldn't it then break at the beginning of the sentence rather than in the
> middle? (I have only worked on English sites).

Huh? Not in any context I can think of.

Re: need help with generating html source from the php

am 27.09.2007 16:29:05 von Macca

Never worked with anything but English but I do know that text
direction can be controlled with CSS e.g.

p {
direction:rtl;

text-align:right
}

[OT - CSS] Re: need help with generating html source from the php

am 27.09.2007 17:11:02 von Bucky Kaufman

"macca" wrote in message
news:1190903345.329646.114740@w3g2000hsg.googlegroups.com...
> Never worked with anything but English but I do know that text
> direction can be controlled with CSS e.g.
>
> p {
> direction:rtl;
>
> text-align:right
> }

That's so error-prone, it should be considered a bug, rather than a feature.
Browsers in languages that stream right-to-left already perform that
function.
So, if you use it the way you did, it'll switch the text back around the
wrong way.

Where that *is* useful is in proprietary HTML extensions, like
"" which are not defined in the HTML/XHMTL spec.

Re: need help with generating html source from the php

am 27.09.2007 17:42:11 von Shelly

"Sanders Kaufman" wrote in message
news:o1PKi.9168$JD.5519@newssvr21.news.prodigy.net...
> "Shelly" wrote in message
> news:13fnapid7bhrdb9@corp.supernews.com...
>> Is it simply that the entire string is captured in the quotes and so
>> appears on the screen as right to left? If that is the case, then what
>> happens with word wrap?
>
> I don't understand the question.
> You had me up until word-wrap.
> When you echo a string, as shown - it spits the result out to std_out as
> composed.
> There's no word-wrap unless the client is doing something like that.
> Does that help answer the question?

As one example, if you have a table of fixed column width and allow
multi-line (a not uncommon situaton), then the text will wrap. What happens
if that text is supposed to be right to left? Treating it all as a one left
to right string will cause it to wrap incorrectly. Does that help you
understand the question?

>
>
>> Wouldn't it then break at the beginning of the sentence rather than in
>> the middle? (I have only worked on English sites).
>
> Huh? Not in any context I can think of.

"ggg fff eee ddd ccc bbb aaa" will wrap as, for example,

"ggg fff eee ddd"
"ccc bbb aaa"

because it assumes left to right. In a right to left language, aaa is the
the first word, bbb the second, etc. We would want it to wrap as:

"ddd ccc bbb aaa"
" ggg fff eee"

That is what I meant. How does one make that kind of thing happen. A
simple echo will wrap incorrectly.

Shelly

>
>
>

Re: need help with generating html source from the php

am 27.09.2007 17:42:41 von Shelly

"macca" wrote in message
news:1190903345.329646.114740@w3g2000hsg.googlegroups.com...
> Never worked with anything but English but I do know that text
> direction can be controlled with CSS e.g.
>
> p {
> direction:rtl;
>
> text-align:right
> }
>

Now THAT answers my question!

Shelly

Re: [OT - CSS] Re: need help with generating html source from the php

am 27.09.2007 17:43:32 von Shelly

"Sanders Kaufman" wrote in message
news:aKPKi.952$4V6.418@newssvr14.news.prodigy.net...
> "macca" wrote in message
> news:1190903345.329646.114740@w3g2000hsg.googlegroups.com...
>> Never worked with anything but English but I do know that text
>> direction can be controlled with CSS e.g.
>>
>> p {
>> direction:rtl;
>>
>> text-align:right
>> }
>
> That's so error-prone, it should be considered a bug, rather than a
> feature.
> Browsers in languages that stream right-to-left already perform that
> function.

.....and that also answers my question!

Shelly

Re: need help with generating html source from the php

am 28.09.2007 13:19:32 von Bucky Kaufman

"Shelly" wrote in message
news:13fnjqlt7862n23@corp.supernews.com...
> "Sanders Kaufman" wrote in message

>>> Is it simply that the entire string is captured in the quotes and so
>>> appears on the screen as right to left? If that is the case, then what
>>> happens with word wrap?
>>
>> I don't understand the question.
>> You had me up until word-wrap.
>> When you echo a string, as shown - it spits the result out to std_out as
>> composed.
>> There's no word-wrap unless the client is doing something like that.
>> Does that help answer the question?
>
> As one example, if you have a table of fixed column width and allow
> multi-line (a not uncommon situaton), then the text will wrap. What
> happens if that text is supposed to be right to left? Treating it all as
> a one left to right string will cause it to wrap incorrectly. Does that
> help you understand the question?

Yeah, I think so.
But for that - you're best answer can be found in the PHP docs at PHP.net -
if you're using PHP's wordwrap thingy.
I don't use it much.


> because it assumes left to right. In a right to left language, aaa is the
> the first word, bbb the second, etc. We would want it to wrap as:
>
> "ddd ccc bbb aaa"
> " ggg fff eee"
>
> That is what I meant. How does one make that kind of thing happen. A
> simple echo will wrap incorrectly.

You'll probably have to create your own function for that.
I don't think PHP is *that* internationalized yet.