Welcome Guest, Not a member yet? Register   Sign In
spaces in my source code.. any help?
#1

[eluser]Zeeshan Rasool[/eluser]
i have blank spaces in my CI site page's source view. Almost 40 lines are blanks and then code appeares.
Any idea about this issues.
Also can it makes any problem if we see in SEO point of view

Thanks:
#2

[eluser]jedd[/eluser]
[quote author="zEsHaN" date="1256556110"]i have blank spaces in my CI site page's source view. Almost 40 lines are blanks and then code appeares.
[/quote]

In every page, or some pages? Post the view of one of the pages that is causing the 'problem'.

Consider that every blank line not encapsulated by <?php and ?> tags will appear as a blank line in your page source.

Quote:Also can it makes any problem if we see in SEO point of view

Eh?
#3

[eluser]Zeeshan Rasool[/eluser]
Offcourse its on every page because im using a common view as a container.
When i click on view page source then from top 44 line are blank and then
after the 44th line html starts

Code:
..
..
44-
45-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
#4

[eluser]eoinmcg[/eluser]
Are you closing your php tags?

http://ellislab.com/codeigniter/user-gui...losing_tag
#5

[eluser]jedd[/eluser]
This is one of those types of bugs that can't really sneak up on you - it suggests that you're not regularly checking the output of your application while you develop it. If you have a [url="http://git-scm.com/"]decent svn[/url], you could [url="http://progit.org/book/ch6-5.html"]work back until you find the point[/url] at which the problem doesn't exist, and then identify what change you made that introduced it.

If you have errors really well suppressed, you might not see 'headers already sent' errors (though I didn't think you could suppress things that much) and in that case you might have html output being delivered by models/controllers/libraries - hence you'd want to look for php-close tags with lots of blank lines following. This seems an unlikely scenario, however.

Really, it's one of those bugs that there's no way we can say 'Oh, 44 blank lines, you say? Easy- that's the well known 44-blank line bug' and then point you at the wiki or previous thread reference. Instead you're just going to have to isolate / substitute each of the components that make up your view until you find the culprit.
#6

[eluser]John_Betong[/eluser]
&nbsp;
Can you try this:
&nbsp;
&nbsp;
$config['log_threshold'] = 1;
&nbsp;
1. set the above value in your ./application/config/config.sys
2. delete your error log file.
3. run your program
4. post the results of the log file.
&nbsp;
&nbsp;
&nbsp;
#7

[eluser]daparky[/eluser]
This usually happens to me if i have alot of if statements on the page, e.g.

Code:
&lt;?php
if(var == 1) { ?&gt;
HTML HERE
&lt;?php
} ?&gt;

&lt;?php
if(var == 2) { ?&gt;
HTML HERE
&lt;?php
} ?&gt;

And so on. I fixed this by doing this:

Code:
&lt;?php
if(var == 1) { ?&gt;
HTML HERE
&lt;?php
} else
if(var == 2) { ?&gt;
HTML HERE
&lt;?php
} ?&gt;

And so on again.
#8

[eluser]BrianDHall[/eluser]
[quote author="zEsHaN" date="1256579257"]Offcourse its on every page because im using a common view as a container.
When i click on view page source then from top 44 line are blank and then
after the 44th line html starts

Code:
..
..
44-
45-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
[/quote]

Maybe change your common header to a totally empty file and see if you still get blanks. If so then it is being fed from somewhere else. The easiest way is probably to call your view at the top of a controller function (page) and see if it has blanks - if not, then it is somewhere inside the functions. They will probably still be there, which means it is higher up - in a constructor, something you are autoloading, a config file, something one of your classes extends, etc.

This could theoretically be a really bad example of content encoding problems, so make sure you aren't saving them in some weird way and ensure you use an editor that supports UTF properly if you are trying to use UTF-8.
#9

[eluser]BrianDHall[/eluser]
If you really want to just get on with it and just want to pretend it didn't happen, try this:

Code:
$html = $this->load->view('common', $data, true);
echo trim($html);

Tadda, fixed! Big Grin
#10

[eluser]Zeeshan Rasool[/eluser]
thanks you all my friends, i have checked but its fine on local but making problem online. also i get log file but it shows nothing
Code:
&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?&gt;

DEBUG - 2009-10-28 00:49:33 --&gt; Config Class Initialized
DEBUG - 2009-10-28 00:49:33 --&gt; Hooks Class Initialized
DEBUG - 2009-10-28 00:49:33 --&gt; URI Class Initialized
DEBUG - 2009-10-28 00:49:33 --&gt; Router Class Initialized
DEBUG - 2009-10-28 00:49:33 --&gt; Output Class Initialized
DEBUG - 2009-10-28 00:49:33 --&gt; Input Class Initialized
DEBUG - 2009-10-28 00:49:33 --&gt; Global POST and COOKIE data sanitized
DEBUG - 2009-10-28 00:49:33 --&gt; Language Class Initialized
DEBUG - 2009-10-28 00:49:33 --&gt; Loader Class Initialized
DEBUG - 2009-10-28 00:49:33 --&gt; Controller Class Initialized
DEBUG - 2009-10-28 00:49:33 --&gt; Helper loaded: url_helper
DEBUG - 2009-10-28 00:49:34 --&gt; Database Driver Class Initialized
DEBUG - 2009-10-28 00:49:34 --&gt; Model Class Initialized
DEBUG - 2009-10-28 00:49:34 --&gt; File loaded: /content/wmcmservers/html/system/me_application/views/site/boxes/started_box.php
DEBUG - 2009-10-28 00:49:34 --&gt; File loaded: /content/wmcmservers/html/system/me_application/views/site/boxes/ilogos_box.php
DEBUG - 2009-10-28 00:49:34 --&gt; File loaded: /content/wmcmservers/html/system/me_application/views/site/boxes/apply_online_box.php
DEBUG - 2009-10-28 00:49:34 --&gt; File loaded: /content/wmcmservers/html/system/me_application/views/site/boxes/evolution_box.php
DEBUG - 2009-10-28 00:49:34 --&gt; File loaded: /content/wmcmservers/html/system/me_application/views/site/started.php
DEBUG - 2009-10-28 00:49:34 --&gt; File loaded: /content/wmcmservers/html/system/me_application/views/site/main.php
DEBUG - 2009-10-28 00:49:34 --&gt; Final output sent to browser
DEBUG - 2009-10-28 00:49:34 --&gt; Total execution time: 1.5402




Theme © iAndrew 2016 - Forum software by © MyBB