You are here: PSPad forum > Bug report / Hlášení chyb > include detection

include detection

#1 include detection

Posted by: CravenA | Date: 11/05/2009 16:59 | IP: IP Logged

I think it's a bug, but not quite sure. Maybe it's up to me to change my coding behaviour.

If you look at the PHP code below, you will see file included via the include(); function, but if you paste this in the editor and open up the 'Code explorator', (Shift+Ctrl+E), be sure to refresh, you will only see that 2 files are included in the file.


<?php

include 'test1.inc';

print("hi"); include 'test2.inc'; print("there");

include 'test3.inc';

?>

The difference is that 'test2.inc' is included AFTER a print(); statement. If it's like this, it's ok;


<?php

include 'test1.inc';

print("hi");

include 'test2.inc'; print("there");

include 'test3.inc';

?>

So I presume that the include detection only works if the include(); function is the first thing on the line.

To include something in the middle of a print statement is great for not making too much lines, like this;


print("
<table>
<tr>
<td>"); include 'tablecontent.inc'; print("</td>
</tr>
</table>
");

instead of making this;


print("
<table>
<tr>
<td>");

include 'tablecontent.inc';

print("</td>
</tr>
</table>
");

That's just a short example.

Thanks, keep up the great ... GREAT work !

Options: Reply | Quote | Up ^


#2 Re: include detection

Posted by: carbonize | Date: 11/05/2009 20:19 | IP: IP Logged

I'd say it's a bug although your style is a little unorthodox and would make reading your code later a lot harder. PSPad is obviously just looking for the first item on each line rather than looking for where that line of code is ended with a ; and looking at what comes next.

--
Carbonize

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2014 Jan Fiala
Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák