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

Getting some errors and not sure the issue

 
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
durangod
Smarty Regular


Joined: 10 Feb 2011
Posts: 39

PostPosted: Fri Sep 01, 2017 5:28 am    Post subject: Getting some errors and not sure the issue Reply with quote

Hi, here is the code:

Code:

1.  {* `Avatar Item` decorator template *}
2.  <div class="ow_avatar{if !empty($data.class)} {$data.class}{/if}">
3.  {if !empty($data.isMarked)}<div class="ow_ic_bookmark ow_bookmark_icon"></div>{/if}
4.  {if !empty($data.url)}
5.  <a href="{$data.url}"><img {if !empty($data.title)} alt="{$data.title|escape}" title="{$data.title|escape}" {/if} {if !empty($data.attrs)}{$data.attrs}{/if} src="{$data.src}" /></a>
6. {else}
7. <img {if !empty($data.title)} alt="{$data.title|escape}" title="{$data.title|escape}"{/if} {if !empty($data.attrs)}{$data.attrs}{/if} src="{$data.src}" />
8. {/if}
9.  {if !empty($data.label)}<span class="ow_avatar_label"{if !empty($data.labelColor)} style="background-color: {$data.labelColor}"{/if}>{$data.label}</span>{/if}
10. </div>


here are the errors im getting

on line 5:

unexpected character after / in tag. Expected >.
Dropped duplicate attribute '{if' on tag
Dropped duplicate attribute 'if}' on tag


line 7:
Unexpected character after attribute value

Line 9:
Unexpected character after attribute value


The page loads fine but in the editor it shows me those errors and im not sure what the deal is. Did i miss a special bracket or something?

thanks
Back to top
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Fri Sep 01, 2017 7:19 am    Post subject: Reply with quote

These errors tell me that Smarty is not parsing this template, and it is the browser making the complaints.

You say "the editor shows you those errors." What editor?
Back to top
View user's profile Send private message
durangod
Smarty Regular


Joined: 10 Feb 2011
Posts: 39

PostPosted: Fri Sep 01, 2017 7:47 am    Post subject: Reply with quote

thanks for the reply.... its the cpanel editor

Its no big deal, i was trying to adjust some css and wanted to test it in that file first. I thought maybe because of those errors it was not parsing my test code.

Its in the oxwall script so no big deal...

If your just curious its in the ow_system_plugins/base/decorators/avatar_item.html

but like i said its no big deal i was just curious myself, hoping to learn something along the way. Smile
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Sep 01, 2017 8:23 am    Post subject: Reply with quote

Editor don't understand the Smarty syntax and assumes the file to be plain HTML based on the file extension.
Generally, it is a bad idea to give a file type extension of a content it does not contain.
Given your present example, in a worst-case scepario an editor could potentially silently "fix" your file, destroying all Smarty code.
Back to top
View user's profile Send private message
durangod
Smarty Regular


Joined: 10 Feb 2011
Posts: 39

PostPosted: Fri Sep 01, 2017 9:13 am    Post subject: Reply with quote

Very educational and makes perfect sense. Thanks for the reply, i did learn something Smile
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