Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 33

Thread: cfincludes

  1. #16
    Regular Coder
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    476
    Thanks
    2
    Thanked 70 Times in 69 Posts
    Nah, you can use as many as you want. Just as long as you yourself can keep track of it all!

  2. #17
    Regular Coder
    Join Date
    Feb 2005
    Posts
    205
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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.

  3. #18
    Regular Coder
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    476
    Thanks
    2
    Thanked 70 Times in 69 Posts
    #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.

  4. #19
    Regular Coder
    Join Date
    Feb 2005
    Posts
    205
    Thanks
    6
    Thanked 0 Times in 0 Posts

  5. #20
    Regular Coder
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    476
    Thanks
    2
    Thanked 70 Times in 69 Posts
    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.

  6. #21
    Regular Coder
    Join Date
    Feb 2005
    Posts
    205
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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 06:32 PM.

  7. #22
    Regular Coder
    Join Date
    Feb 2005
    Posts
    205
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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

  8. #23
    Regular Coder
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    476
    Thanks
    2
    Thanked 70 Times in 69 Posts
    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.

  9. #24
    Regular Coder
    Join Date
    Feb 2005
    Posts
    205
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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 01:46 AM.

  10. #25
    Regular Coder
    Join Date
    Feb 2005
    Posts
    205
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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

  11. #26
    Regular Coder
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    476
    Thanks
    2
    Thanked 70 Times in 69 Posts
    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.

  12. #27
    Regular Coder
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    476
    Thanks
    2
    Thanked 70 Times in 69 Posts
    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...

  13. #28
    Regular Coder
    Join Date
    Feb 2005
    Posts
    205
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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?

  14. #29
    Regular Coder
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    476
    Thanks
    2
    Thanked 70 Times in 69 Posts
    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.

  15. #30
    Regular Coder
    Join Date
    Feb 2005
    Posts
    205
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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 01:49 AM.


 
Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •