php-general Digest 7 Oct 2006 23:50:04 -0000 Issue 4388
Topics (messages 242796 through 242804):
Re: Testing people
242796 by: Ryan A
Re: Unicode Problem
242797 by: tedd
Re: Set Variable = Long HTML String?
242798 by: sit1way
242799 by: John Wells
242800 by: David Tulloh
242801 by: John Wells
Re: set cookie with non-english
242802 by: Ahmad Al-Twaijiry
Re: Separate PHP Code From HTML || Pros & Cons?
242803 by: sit1way
FTP
242804 by: Raphael Martins
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 ---
Thanks!
Will give it a look-see!
Cheers!
Dotan Cohen <[EMAIL PROTECTED]> wrote: It's not exactly what you describe, but
you should take a look at:
http://www.bigredspark.com/survey.html
Dotan Cohen
http://what-is-what.com
7
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates
starting at 1¢/min.
--- End Message ---
--- Begin Message ---
At 4:15 PM -0500 10/6/06, Richard Lynch wrote:
Perhaps you would care to extend your browsercam test to some
regression testing of more ancient browsers -- on Mac OS.
The following goes back to IE 5.2 for the Mac -- that's as far back
as BrowserCam goes.
http://www.browsercam.com/public.aspx?proj_id=289683
I think you meant x2022 a.k.a. (dec)8226 :-)
Ahh, a typo thanks.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hey all.
I'm overhauling my PHP based CMS and want to know how to set a variable
equal to an HTML string, but without having to escape all the quotes!
Example:
$var = "<form name="events" method="POST" action="">
<select class="menus" name="news"
onChange="MM_jumpMenu('parent',this,0);">
<option selected>News Options</option>
<option value=<? echo $this->doc_path
?>admin/news/add/1/>Add</option>
<option value=<? echo $this->doc_path
?>admin/news/update/1/>Update</option>
<option value=<? echo $this->doc_path
?>admin/news/delete/1/>Delete</option>
</select>
</form>";
This will die due to all the unescaped strings, not to mention the <? echo
$this->doc_path ?> statements.
How to pull this off? I don't want to include the HTML snippets as they are
"sprinkled" throughout my classes.
TIA,
--Noah
--- End Message ---
--- Begin Message ---
On 10/7/06, sit1way <[EMAIL PROTECTED]> wrote:
I'm overhauling my PHP based CMS and want to know how to set a variable
equal to an HTML string, but without having to escape all the quotes!
Noah, meet HEREDOC. HEREDOC, meet Noah:
http://uk.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Now you cozy two, let's make it a party with the Complex (Curly {}) syntax:
http://uk.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex
All together now!
[code]
$var =<<<HEREDOC
<form name="events" method="POST" action="">
<select class="menus" name="news" onChange="MM_jumpMenu('parent',this,0);">
<option selected="selected">News Options</option>
<option value="{$this->doc_path}admin/news/add/1/">Add</option>
<option value="{$this->doc_path}admin/news/update/1/">Update</option>
<option value="{$this->doc_path}admin/news/delete/1/">Delete</option>
</select>
</form>
HEREDOC;
[/code]
HTH,
John W
TIA,
--Noah
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
You can mingle double and singal quotes. So choose one for the PHP
quotes and one for the HTML quotes, HTML will use both interchangably.
For example your string could become:
$var = "<form name='events' ...";
I'd also look at the echo's inside the string, they look like they
shouldn't be there.
David
sit1way wrote:
> Hey all.
>
> I'm overhauling my PHP based CMS and want to know how to set a variable
> equal to an HTML string, but without having to escape all the quotes!
You can mingle double and singal quotes. So choose one for the PHP
quotes and one for the HTML quotes, HTML will use both interchangably.
For example your string could become:
$var = "<form name='events' ...";
The echo's inside the string also aren't necessary. Just use the value
directly when building the string.
David
> Example:
>
> $var = "<form name="events" method="POST" action="">
> <select class="menus" name="news"
> onChange="MM_jumpMenu('parent',this,0);">
> <option selected>News Options</option>
> <option value=<? echo $this->doc_path
> ?>admin/news/add/1/>Add</option>
> <option value=<? echo $this->doc_path
> ?>admin/news/update/1/>Update</option>
> <option value=<? echo $this->doc_path
> ?>admin/news/delete/1/>Delete</option>
> </select>
> </form>";
>
> This will die due to all the unescaped strings, not to mention the <? echo
> $this->doc_path ?> statements.
>
> How to pull this off? I don't want to include the HTML snippets as they are
> "sprinkled" throughout my classes.
>
> TIA,
>
> --Noah
>
>
>
>
--- End Message ---
--- Begin Message ---
On 10/7/06, Noah Cutler <[EMAIL PROTECTED]> wrote:
Yah, John.
Just found it via Google.
I remembered seeing this somewhere a couple years back but never used it.
Very cool -- performance hit using this, or just a really useful function?
From what I understand it suffers the same "hit" as double quotes,
since PHP has to parse it looking for variables. But it's not really
"special", it's just not as well known.
- John W
Thanks,
--Noah
----- Original Message -----
From: "John Wells" <[EMAIL PROTECTED]>
To: "sit1way" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Saturday, October 07, 2006 12:03 PM
Subject: Re: [PHP] Re: Set Variable = Long HTML String?
> On 10/7/06, sit1way <[EMAIL PROTECTED]> wrote:
>> I'm overhauling my PHP based CMS and want to know how to set a variable
>> equal to an HTML string, but without having to escape all the quotes!
>
> Noah, meet HEREDOC. HEREDOC, meet Noah:
>
>
http://uk.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
>
> Now you cozy two, let's make it a party with the Complex (Curly {})
> syntax:
>
>
http://uk.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex
>
> All together now!
>
> [code]
> $var =<<<HEREDOC
> <form name="events" method="POST" action="">
> <select class="menus" name="news"
> onChange="MM_jumpMenu('parent',this,0);">
> <option selected="selected">News Options</option>
> <option value="{$this->doc_path}admin/news/add/1/">Add</option>
> <option
> value="{$this->doc_path}admin/news/update/1/">Update</option>
> <option
> value="{$this->doc_path}admin/news/delete/1/">Delete</option>
> </select>
> </form>
> HEREDOC;
> [/code]
>
> HTH,
> John W
>
>> TIA,
>>
>> --Noah
>>
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
--- End Message ---
--- Begin Message ---
BTW I want to access the (cookie or session) variable from php &
javascript, so I don't think session is a solution
so again, does anyone know how to resolve the problem so I can write
the cookie output to UTF-8 html page ?
On 10/5/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
On Tue, October 3, 2006 11:18 pm, Ahmad Al-Twaijiry wrote:
> I already made the application with cookies, it's will be very
> defaucalt to go and replace cookies with session,
>
> is it possible to use cookies & session in the same time ? (
> session_start() & setcookie in the same page ?)
Sure...
Though if it's hard to convert your Cookies code to session_start()
you've done something very wrong already... ;-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--
Ahmad Fahad AlTwaijiry
--- End Message ---
--- Begin Message ---
Hey all.
I've built a simple, yet effective PHP based CMS, one that I use in all
sites I develop.
Unfortunately, from site-to-site, functionality may be different; i.e. I
often have to extend the original CMS to account for custom client needs,
which means grabbing the most recent version of my CMS, and hacking it to
address whatever customization is required.
This presents problems in that any updates I make to the CMS only affect the
site I'm working on. So, while working on one site I may make changes to
the CMS, changes that improve the app., but other older sites do not get
updated -- it's OK now, but things are getting sloppy ;--)
I would dearly love to have a base CMS repository that all sites would draw
on, extending the base CMS in the event that a particular client has need of
customization. Some combo of Linux and Apache would do the trick; e.g. PHP
requests for any of my sites would point to say, "/home/cms/includes/"
That would help (not solve) the version control problems I'm running into
now (still have to figure out how to extend the CMS for customization).
Now, the other issue I'd like to address is separating PHP code logic from
site HTML.
I've restructured my CMS classes to do all MySQL queries, code logic, etc.
prior to calling target HTML template. This is great in that now when an
error occurs, I can catch { throw new Exception($e) } and gracefully display
the error along with a means to repopulating the offending form page.
I've often heard the mantra, "separate code from HTML", but it seems
ridiculous at times to include tiny HTML snippets that can easily be echoed
out, or stored in a variable. Smarty goes to the extreme in separating code
from HTML, but looking at their templating system, I wonder what's the
point? Is it the end of the world if you've got a few choice if, then, else
statements in your HTML templates?
I'm thinking of creating a bunch of include files based on request type in
my CMS Admin Center; e.g. include "classes/admin/news/add.php", where add,
update, or delete is the request type. This cleans up my PHP processing
pages quite a bit (don't have all the if add, do X, elseif update, do Y,
etc. logic to comb through).
Last thing to do is write up a generic form builder class to assemble my
form pages, but that may be more work than necessary -- K-rist, webwork is
messy business ;--)
Clues, Opinions, etc. are welcome.
TIA,
--Noah
--- End Message ---
--- Begin Message ---
Hi,
When I send files via FTP, the file size is limited to the php.ini max
upload value?
Thank you!
--- End Message ---