Current location: Hot Scripts Forums » Programming Languages » PHP » Using Templates - Parse Error


Using Templates - Parse Error

Reply
  #1 (permalink)  
Old 02-13-04, 11:49 PM
simone's Avatar
simone simone is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Using Templates - Parse Error

Ok im using templates for my new site, and i want to be able to use double quotes " . At the moment my html code looks like this ... <a href=page.html target=_blank> type thing, and it's annoying, so is there some code i can put somewhere use to be able to use the double quotes?
Reply With Quote
  #2 (permalink)  
Old 02-14-04, 11:04 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
do you mean that you want to show double quotes in your pages or use them in HTMLs ?
if you want to display them you can use &quot;
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #3 (permalink)  
Old 02-14-04, 05:02 PM
simone's Avatar
simone simone is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
oh, i want to be able to use them in my template html, like i said at the moment my html looks like this <a href=page.html target=_blank> i want it looking like this <a href="page.php" target="blank">

So at the moment when i use " anywhere in my templates, im getting a parse error.

Oh and if it helps, my templates are stored in a mysql DB
Reply With Quote
  #4 (permalink)  
Old 02-14-04, 06:09 PM
windwind windwind is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Use singel quotes for your html

<a href='link url'>something here</a>

Run it through the validator and it'll validate.

If you want double quotes in your HTM you'll probably have to escape them with a backslash (\").
Reply With Quote
  #5 (permalink)  
Old 02-15-04, 02:06 AM
simone's Avatar
simone simone is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
ya, im picky i really dont want to use single qoutes or backslashes ....i know the double quotes can be done, because a few scripts i use, do it ..for example XMB
Reply With Quote
  #6 (permalink)  
Old 02-15-04, 04:24 AM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

If I may jump in, I always use single quotes in PHP (except for SQL statements for some personal and practical reasons). This way, I don't have to worry about escaping every single double quotes in HTML. Downside of doing this is that you need to concatinate variables like this (thus a few more key strokes):

PHP Code:

$mystr 'This is '.$myvar1.' and here is another '.$myvar2
But I actually like it. It's more syntax-highlighting friendly than this as you can see (same line in double quotes):

PHP Code:

$mystr "This is $myvar1 and here is another $myvar2"
Another downside would be that you'd have to literally linebreak, tab, etc (all the escaping sequence), but I still think it's worth putting up with than escaping every single double quotes in HTML.

My 2 cents.
__________________
Blavv =|
Reply With Quote
  #7 (permalink)  
Old 02-15-04, 04:50 AM
0zone 0zone is offline
Newbie Coder
 
Join Date: Feb 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by simone
ya, im picky i really dont want to use single qoutes or backslashes ....i know the double quotes can be done, because a few scripts i use, do it ..for example XMB
Ok, first thing, what template engine are you using? and what error do you get when using double quotes?
Reply With Quote
  #8 (permalink)  
Old 02-15-04, 07:38 AM
simone's Avatar
simone simone is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
i've actually been able to get it working the way i want now, just mucked around a little with some codes, and its working fine. Thanks for your help anway guys
Reply With Quote
  #9 (permalink)  
Old 02-15-04, 10:47 PM
nd2 nd2 is offline
Wannabe Coder
 
Join Date: Jun 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
if it's mysql based remember to use addslashes() before entering it in to the database and stripslashes() when getting it out.
if you are using regular expressions use the special preg_quote() function to backspace any charactor with meaning.
__________________
IonCMS (Coming Soon.)
http://ioncms.com
--
Ncaster (Free php/mysql cms)
http://ncaster.cjb.net
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New to Java: weird main error msg hecresper Everything Java 2 02-10-04 03:03 PM
asp-iis-Server error nsuresh_rasr ASP.NET 3 02-08-04 12:47 AM
parse error... help? kappler0 PHP 2 01-21-04 03:57 AM
[php error] parse error | fatal error xeoHosting PHP 1 01-03-04 08:12 PM
php error plz help darkcarnival PHP 2 11-19-03 08:14 PM


All times are GMT -5. The time now is 08:48 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.