Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Odd characters inserted when display() is called

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
carnedv
Smarty Rookie


Joined: 22 Aug 2005
Posts: 7

PostPosted: Mon Aug 22, 2005 9:35 pm    Post subject: Odd characters inserted when display() is called Reply with quote

Hi, longtime Smarty user, first time poster.

I just transferred a site I was working on from the dev server to the live server (via FTP) and on the live side of the site, the characters '' appear at the top of each page that Smarty builds. I can isolate the problem to the display() function but I can't get those characters to go away. I reloaded the Smarty class files and templates, all of which are still working fine on the dev server and the problem persists, which would make me think that it's not smarty @ all, save that these characters are only showing when Smarty is run.

I'm perplexed, any suggestions?

Thanks,
carnedv
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Mon Aug 22, 2005 10:24 pm    Post subject: Reply with quote

That sounds like at least one of your template files have been modified and saved using an editor that is inserting Byte-Order-Marks (BOM's) at the start of the file. PHP dies when it sees them. Tell your editor not to use them. If it isn't your editor, perhaps one of the tools in your process chain is doing the same -- if so, disable it.
Back to top
View user's profile Send private message
carnedv
Smarty Rookie


Joined: 22 Aug 2005
Posts: 7

PostPosted: Mon Aug 22, 2005 11:16 pm    Post subject: Reply with quote

boots:
thanks for the quick reply...i'm pretty much certain that no editor has touched those files except dreamweaver...
1 thing that has happened to the files though is that they were copied to a cd before being uploaded, so maybe something happened there...
what does one do to correct this problem? do i have to retrieve an older version of the files or will resaving in a valid editor do the trick?

thanks again,
carnedv
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Aug 23, 2005 2:19 am    Post subject: Reply with quote

Well, first verify that that is the problem. For example, try viewing the files from the command line and see if those chars are there. Surely one file (perhaps not even a template file?) on your server has a BOM mark. Once you find the specific offending file(s), do ensure that Dreamweaver (or whatever editor you decide on) is not inserting those characters by turning off the appropriate option. Note that most editors will insert and handle those characters but NOT show them -- so do go over the option settings (sorry, I don't know Dreamweaver) and then resave the file(s).

Again, ensure that it is the templates that are at issue. Perhaps it is a config file or a php class file?
Back to top
View user's profile Send private message
carnedv
Smarty Rookie


Joined: 22 Aug 2005
Posts: 7

PostPosted: Tue Aug 23, 2005 4:01 pm    Post subject: Reply with quote

Well, I was able to narrow down the error to just 4 templates and all of them were built from layouts orginally created in Photoshop and sliced by ImageReady. I can't remember if I copied and pasted the code to a new .tpl file or simply deleted the parts that I didn't need and 'Save As'ed them, but I would suspect the latter would have allowed any weirdness that ImageReady might have done to stick around. What's weird is this didn't show up on the dev server, it wasn't until they were on the live server that I saw the problem.

Anyways, thanks for your help, and for Smarty, sure helps a lot for the work I do.

carnedv
Back to top
View user's profile Send private message
hawken
Smarty n00b


Joined: 20 Sep 2005
Posts: 1
Location: Dillon, CO

PostPosted: Tue Sep 20, 2005 3:48 pm    Post subject: This is a problem for me too Reply with quote

Been searching all over for someone else havingthis problem, and discovered this thread. I see the same characters "" at the top of some of my pages, but it doesn't seem to be related to the templates specifically. It tends to appear and disappear sporadically, and I can't get rid of it. I've checked my templates with the DOS editor, with several other text editors that show invisibles, and I've had other friends look too. I simply cannot find the source of these mystery characters. Could there be any other cause, or another thread that discusses this issue that I'm not finding?

Thanks,

Brandon
Back to top
View user's profile Send private message AIM Address
carnedv
Smarty Rookie


Joined: 22 Aug 2005
Posts: 7

PostPosted: Tue Sep 20, 2005 3:55 pm    Post subject: In the Smarty 'program' scripts? Reply with quote

I'm just throwing a wild guess here, but since Smarty uses includes for the files that parse and render the finished page, and therefore are executed before any Smarty-ed content, then maybe the binary chars are in one of those files, which makes it appear at the top of the page. Might try a fresh Smarty install and see if it straightens it out. Like I said, though, just a guess.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP