Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2008
    Posts
    340
    Plugin Contributions
    0

    Default When looking for extra lines and spaces in php files...

    When looking for extra lines and spaces in php files, what excactly are they talking about
    I've the Rss feed addon and have to look for white spaces and lines in the begining and the end of files cause I get an error .

    My question : what should I be looking for ?

    This is reaaly a stupid question for most of you but I'm not familiar with php

  2. #2
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: When looking for extra lines and spaces in php files...

    Blank lines and spaces at the beginning or end of a php file can cause all sorts of problems with the php processor. Your php files should begin with

    Code:
    <?php
    and end with

    Code:
    ?>
    There shouldn't be any blank lines or spaces before or after those.
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  3. #3
    Join Date
    Aug 2008
    Posts
    340
    Plugin Contributions
    0

    Default Re: When looking for extra lines and spaces in php files...

    I found a script that looks for these and it says I have a blank space at the end of this file:


    //DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . '

    || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';
    ?>
    <?php echo rss_feed_link_alternate(); // RSS Feed ?>
    </head>
    <?php // NOTE: Blank line following is intended: ?>

    Where is the error?

  4. #4
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: When looking for extra lines and spaces in php files...

    It's impossible to tell this way. Open the file in question in a good text editor like Notepad++ or Crimson Editor (regular Notepad will do as well). Position your cursor after the closing ?> and delete any extra lines or spaces.
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  5. #5
    Join Date
    Aug 2008
    Posts
    340
    Plugin Contributions
    0

    Default Re: When looking for extra lines and spaces in php files...

    This is the end of my html_header.php file:

    }

    //DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';
    ?>
    <?php echo rss_feed_link_alternate(); // RSS Feed ?>
    </head>
    <?php // NOTE: Blank line following is intended: ?>

    Where to look?

  6. #6
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,246
    Plugin Contributions
    58

    Default Re: When looking for extra lines and spaces in php files...

    Quote Originally Posted by lieven23 View Post
    This is the end of my html_header.php file:

    }

    //DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';
    ?>
    <?php echo rss_feed_link_alternate(); // RSS Feed ?>
    </head>
    <?php // NOTE: Blank line following is intended: ?>

    Where to look?
    The file you have listed is intended to have a extra line (blank after it). Language files become "broken" when an additional linebreak or spaces follow the closing ?>

    Like this

    This is good
    Code:
    ?>
    This is not
    Code:
    ?>space
    or space
    ~Melanie
    PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are not conducive to a helpful community.

  7. #7
    Join Date
    Jul 2007
    Posts
    53
    Plugin Contributions
    0

    Default Re: When looking for extra lines and spaces in php files...

    Another method I use is to highlight the code. You can use 'Select All' or just press the left mouse key and scroll over the area. You will see the White space at the end of lines or at the bottom of the code as blank blue space.

    this is a try.

    Just left click over the above from the beginning to the end. The white space shows as blank blue.

    Hope that makes sense.

  8. #8
    Join Date
    Sep 2009
    Location
    Liverpool
    Posts
    96
    Plugin Contributions
    0

    Default Re: When looking for extra lines and spaces in php files...

    If I edit a file or install a new add-on, sometimes my website will just show blank pages so I have to go thru almost all files to look for these extra empty lines. I do it but it takes me an eternity. I have two questions.

    1. Why do these extra lines appear?
    2. Is there an easier way of finding these extra empty lines?

  9. #9
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: When looking for extra lines and spaces in php files...

    Article on finding problems causing blank pages: https://www.zen-cart.com/tutorials/index.php?article=82
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v150 Looking for help Merging Files for Plugins
    By CnTGifts in forum General Questions
    Replies: 3
    Last Post: 27 Aug 2012, 06:39 AM
  2. php files called when accessing product_listing.php page
    By Tonyy in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 4 Dec 2011, 12:46 AM
  3. when looking for extra lines and spaces in php files...
    By lieven23 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 27 Aug 2009, 04:53 AM
  4. adding extra lines when in check out
    By svazquez in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 16 May 2009, 07:10 AM
  5. Extra '/' on links and other lines
    By prodesk in forum General Questions
    Replies: 11
    Last Post: 31 Dec 2006, 04:49 AM

Posting Permissions

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