Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > ColdFusion

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 27 votes, 5.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-03-2009, 07:49 PM   PM User | #16
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
Nah, you can use as many as you want. Just as long as you yourself can keep track of it all!
Gjslick is offline   Reply With Quote
Old 12-04-2009, 11:02 PM   PM User | #17
wyclef
Regular Coder

 
Join Date: Feb 2005
Posts: 149
Thanks: 1
Thanked 0 Times in 0 Posts
wyclef is an unknown quantity at this point
do you know anything about the bs dreamweaver cfm file bug where it inserts line breaks when u upload a file and NO i don't use dreamweaver and dont like the program at all so nobody give me a hard time about dreamweaver because i'm already having a hard enough time dealing with the stupid dreamweaver bs bug.
wyclef is offline   Reply With Quote
Old 12-05-2009, 01:23 AM   PM User | #18
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
#1) What exactly are you talking about? What exactly happens?
#2) What version of Dreamweaver are you using? I'm using Dreamweaver 8 (have been for years) and have never had a problem like that.
#3) Don't go posting on the forum all P.O'd in a rambling rant that doesn't make any sense. Calm down and explain.
Gjslick is offline   Reply With Quote
Old 12-05-2009, 02:14 AM   PM User | #19
wyclef
Regular Coder

 
Join Date: Feb 2005
Posts: 149
Thanks: 1
Thanked 0 Times in 0 Posts
wyclef is an unknown quantity at this point
http://dwmommy.com/?day=1/15/2006
wyclef is offline   Reply With Quote
Old 12-05-2009, 05:11 PM   PM User | #20
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
Quote:
Originally Posted by wyclef View Post
do you know anything about the bs dreamweaver cfm file bug where it inserts line breaks when u upload a file and NO i don't use dreamweaver and dont like the program at all so nobody give me a hard time about dreamweaver because i'm already having a hard enough time dealing with the stupid dreamweaver bs bug.
Ok that link in your previous post had nothing to do with "dreamweaver cfm file bug where it inserts line breaks when u upload a file"

But also, I never use the design view. I not only prefer to write the HTML myself, but it's also just a lot easier to integrate with the server side processing that ColdFusion (or any other language) does when you write it yourself.
Gjslick is offline   Reply With Quote
Old 12-06-2009, 09:23 PM   PM User | #21
wyclef
Regular Coder

 
Join Date: Feb 2005
Posts: 149
Thanks: 1
Thanked 0 Times in 0 Posts
wyclef is an unknown quantity at this point
yes... I KNOW all about dreamweaver design view crap. i have to pass the files along to someone who uses dreamweaver. basically there is an additional line break for every cfinclude.

Code:
<cfinclude template="#root#/includes/heading.cfm">
it seems like there is some issue with Dreamweaver... do i need to add a /> at the end of each include?

http://www.cfinternals.org/blog/2008...eaver-cs3.html

sorry but i can't deal with dreamweaver.

Last edited by wyclef; 12-07-2009 at 05:32 PM..
wyclef is offline   Reply With Quote
Old 12-06-2009, 10:29 PM   PM User | #22
wyclef
Regular Coder

 
Join Date: Feb 2005
Posts: 149
Thanks: 1
Thanked 0 Times in 0 Posts
wyclef is an unknown quantity at this point
i cant quite put my finger on what the problem is but it seems like i'm not the only one struggling with include files and dreamweaver... http://kb2.adobe.com/cps/165/tn_16511.html
wyclef is offline   Reply With Quote
Old 12-06-2009, 10:56 PM   PM User | #23
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
Yeah that's weird stuff. Perhaps it has to do with invalidly nested code though. Make sure all of your html is properly formatted, with matching end tags for tags that need them, and in the correct spots.

Come to think of it, I have in fact seen that issue once before, a really long time ago. A developer that I was working with was doing kind of a hack per se, where inside a loop he had a cfif to insert </tr><tr> tags in after so many iterations of the loop (to break things into new table rows after so many items had been outputted). This resulted in valid HTML code in the web browser when ColdFusion was done processing the page, but Dreamweaver would get confused with it and try to re-write some of the code to put in </td>'s and </tr>'s where it thought that they were supposed to go. Mad annoying, but I haven't seen that issue since.

So maybe this has to do with your issue. Are you using HTML tables? If you are, make sure that the table's tags are correctly nested. The 3 required tags (table, tr, td) should always be like this:
Code:
<table>
  <tr>
    <td>Data in row 1</td>
    <td>More Data in row 1</td>
  </tr>

  <tr>
    <td>Data in row 2</td>
    <td>More Data in row 2</td>
  </tr>
</table>
And don't ever have any other HTML code (forms, text, w/e) between the <table> and <tr> tags, or the <tr> and <td> tags, or even between </td> and <td> tags. Make sure all opening <tr>'s and <td>'s are closed at the proper location as well.

If you're not using tables, check for other unclosed start tags, like <li> tags, <option> tags, or even <div> tags and such. Your page may render correctly in the browser (because browsers are built with developer idiocy in mind), but that doesn't mean that you have correct/valid code.

----------------------------------------

On this same note, does this only happen with specific pages, or all of your pages? If you want, post your source code on a page it happens to, and I'll take a look at it for any issues that I can spot.

-Greg


P.S. No, you do not need to make the <cfinclude> tag self closing (with the />). ColdFusion doesn't care either way, but apparently Dreamweaver does, according to that link you posted earlier.
Gjslick is offline   Reply With Quote
Old 12-06-2009, 11:00 PM   PM User | #24
wyclef
Regular Coder

 
Join Date: Feb 2005
Posts: 149
Thanks: 1
Thanked 0 Times in 0 Posts
wyclef is an unknown quantity at this point
no tables. all the code validates perfectly. the only code that doesn't validate is some embed src to display a pdf from the issuu.com site but that code isn't in the include files. it seems like there are exactly the same number of line breaks as cfinclude tags and in the same location in the source. not sure if it matters but i also have some cfsets in there as well.

Last edited by wyclef; 12-07-2009 at 12:46 AM..
wyclef is offline   Reply With Quote
Old 12-07-2009, 06:00 PM   PM User | #25
wyclef
Regular Coder

 
Join Date: Feb 2005
Posts: 149
Thanks: 1
Thanked 0 Times in 0 Posts
wyclef is an unknown quantity at this point
check this page out. that guy uses /> to close his cfinclude tag and runs into a similar issue. check out the first demo

http://www.bennadel.com/blog/250-CFI...-File-Type.htm
wyclef is offline   Reply With Quote
Old 12-07-2009, 06:17 PM   PM User | #26
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
Nah that link has nothing to do with your issue. Ben is saying that by using a cfinclude tag, whatever document that is included is parsed for ColdFusion tags, regardless of the file extension. You could do: <cfinclude template="myPage.html"> and myPage.html would be treated as a .cfm page.

Php's include statement works the same way. Even if you do: include( 'myFile.html' ), myFile.html is treated as a php file, and is parsed for <?php and ?> tags.
Gjslick is offline   Reply With Quote
Old 12-07-2009, 11:33 PM   PM User | #27
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
Ok, here's what's happening. When ColdFusion processes a page, it takes all of your CF tags, processes them, and then returns the resulting HTML page to the browser. So the resulting HTML that the browser gets, appears as though CF tags have been "removed."

The thing is, anything outside of a CF tag does not get removed. That includes the line breaks around your CF tags. Here's an example, and the reason why you have those extra line breaks in the source:

Code:
<cfset root = "/root_path/">(LINE BREAK)
<cfset title = "Title">(LINE BREAK)
<cfset bodyid = "home">(LINE BREAK)
(LINE BREAK)
<cfset block = "Some Text">(LINE BREAK)
(LINE BREAK)
<cfinclude template="#root#/includes/header.cfm">(LINE BREAK)
<cfinclude template="#root#/includes/nav.cfm">(LINE BREAK)
<cfinclude template="#root#/includes/subnav.cfm">(LINE BREAK)
All of those line breaks stay in the resulting document that gets generated.

There's two things you can do about it, if you so chose. One is the <cfsilent> tag. It suppresses all output between <cfsilent> and </cfsilent>. Ex:
Code:
<cfsilent>
  <cfset root = "/root_path/">
  <cfset title = "Title">
  <cfset bodyid = "home">

  <cfset block = "Some Text">
</cfsilent>(Line Break, can't do anything about it)

<!--- Don't want to wrap your includes in a <cfsilent>, as it would suppress their output --->
<cfinclude template="#root#/includes/header.cfm">(LINE BREAK)
<cfinclude template="#root#/includes/nav.cfm">(LINE BREAK)
<cfinclude template="#root#/includes/subnav.cfm">(LINE BREAK)
OR, what you could do, is use the <cfsetting> tag to only enable output for things that are inside a <cfoutput> tag. This is sometimes not as easy to work with though, and you will be pulling your hair out if you forget its there and are trying to output text to the page which is outside of a <cfoutput> tag. Ex:
Code:
<cfsetting enableCFOutputOnly="yes">

<!--- Yee haw, no line breaks in the generated output --->
<cfset root = "/root_path/">
<cfset title = "Title">
<cfset bodyid = "home">

<cfset block = "Some Text">

This text, although sitting directly on the page, will NOT be displayed in the page's output, because it is not within <cfoutput> tags.

<cfoutput>This text will be displayed in the page's output.</cfoutput> <!--- Don't even get a line break here --->
Note that if you do it that way, that each of your included templates will need the <cfsetting> tag as well, as it only applies to the template where it is used. And all of your html code would need to be within <cfoutput> tags. I actually do this anyway, putting <cfoutput> at the start of my html output, and </cfoutput> at the end. If I need to loop over a query, I use <cfloop query=""> instead of <cfoutput query="">.

Wish you just described your problem in the first place...
Gjslick is offline   Reply With Quote
Old 12-07-2009, 11:58 PM   PM User | #28
wyclef
Regular Coder

 
Join Date: Feb 2005
Posts: 149
Thanks: 1
Thanked 0 Times in 0 Posts
wyclef is an unknown quantity at this point
what about this guy who does both? http://www.bennadel.com/blog/369-CFS...Reset-True.htm

so if i do the second option i have to include that in every included file as well? i can't just put it in the doctype include file?
wyclef is offline   Reply With Quote
Old 12-08-2009, 12:21 AM   PM User | #29
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
Dude, honestly, you're putting way too much time and effort into this for a few extra lines in the source code that nobody will ever see, and which also your CF9 will automatically suppress. Tell them to upgrade if the have the $$.

But otherwise, just stick with the <cfsilent> tag instead of confusing yourself with the <cfcontent> tag, which btw I've never seen used like that, although it would in fact work to suppress those extra 3 line breaks that you might have... Honestly, I wouldn't have even wasted my time with 3 line breaks even if everyone in America were on 56k modems, let alone the high speed internet that most people have nowadays.
Gjslick is offline   Reply With Quote
Old 12-08-2009, 12:39 AM   PM User | #30
wyclef
Regular Coder

 
Join Date: Feb 2005
Posts: 149
Thanks: 1
Thanked 0 Times in 0 Posts
wyclef is an unknown quantity at this point
i've come this far... might as well go the full distance at this point. so what if you are using cfcontent in the html to output variables... can you nest cfcontent in cfcontent? i see what you are saying, using this <cfsetting enableCFOutputOnly="yes"> is a bit more involved but i think i almost get it... just can't get it to work. do i wrap the cfincludes with the cfcontent as well? wait, if i wrap cfincludes in cfoutput am i going to have to escape every single # sign that makes up a variable?

Last edited by wyclef; 12-08-2009 at 12:49 AM..
wyclef is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:39 PM.


Advertisement
Log in to turn off these ads.