1
playsome
Trying to get extcal minical block template to validate
  • 2011/12/31 0:10

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hi All,

I am in the process of trying to get my site to validate as xhtml transitional, I think my theme is fine but I am having trouble with the extcal_block_minical.html template.

When i run the validator I get a lot of end tag for 'a' omitted errors but when I look at the source of the page using firebug I can see that table cells with events (the date is a link) are fine and the closing does not appear to be missing.

I think the problem stems from this piece of code:

<a href="<{$xoops_url}>/modules/extcal/day.php?year=<{$weeks.weekInfo.year}>&month=<{$weeks.weekInfo.month}>&day=<{$day.number}>"><{/if}><{$day.number}>
                    <{if 
$day.isEvent}>a>


and more specifically the smarty tag <{if $day.isEvent}>, by the looks of it the code is saying if the day is an event then close the a tag, looking at the rest of the code I cant seem to work out what the smarty tag does, however removing it and the closing if or putting the tag after the closing seems to break the layout of the table and strethches the table cells.

It seems as if the smarty tag is causing the closing to not show to the validator but I can see it in the source code. Take a look for yourself at http://www.whitlawburncrc.org.uk run the homepage through the markup validator.

Does anyone know of a solution to fix this problem or know what that smarty tag is for and a way to remove it without breaking the entire layout?

Thanks


2
Peekay
Re: Trying to get extcal minical block template to validate
  • 2011/12/31 19:15

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


There should be an opening tag for the first IF condition somewhere in the template and a closing tag for the <{if $day.isEvent}> statement, e.g. <{/if}>. If you can post a bit more of the template code it would help.

I have come across templates that omit closing tags and of course the page will still work in most browsers. To get the page to validate, short of re-writing the template, you can try putting a rogue opening tag in an IF statement which is the same as the closing one, e.g.

<{if $day.isEvent}><b><{/if}>Only bold if day is an event<{if $day.isEvent}>b><{/if}>


Of course, the above would leave the text without any tags if the condition was false, so you have to give it some thought.
A thread is for life. Not just for Christmas.

3
playsome
Re: Trying to get extcal minical block template to validate
  • 2011/12/31 19:29

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hi peekay, thanks for your reply

heres the full code for the minical template

<div id="miniCalWrapper">
<
table class="calMinical" style="width:100%; text-align:center; vertical-align:middle;" summary="Events for this month">
    <
tr class="miniCalNavigMonth">
        <
td colspan="7"><h3 class="miniCalNavigMonthName"><a href="<{$xoops_url}>/modules/extcal/calendar-month.php?<{$block.navig.uri}>"><{$block.navig.name}>a>h3>td>
    tr>
    <
tr class="miniCalWeekDays">
        <{foreach 
item=day from=$block.weekdayNames}>
        <
th><{$day}>th>
        <{/foreach}>
    tr>
    <{foreach 
item=weeks from=$block.tableRows}>
    <
tr class="miniCalDates">
        <{foreach 
item=day from=$weeks.week}>
        <
td>
            <{if !
$day.isEmpty}>
                <{if 
$day.haveEvents}>
                    <
a href="<{$xoops_url}>/modules/extcal/day.php?year=<{$weeks.weekInfo.year}>&month=<{$weeks.weekInfo.month}>&day=<{$day.number}>"><{/if}><{$day.number}><{if $day.isEvent}>a>
                <{/if}>
            <{else}>
                &
nbsp;
            <{/if}>
        td>
        <{/foreach}>
    tr>
    <{/foreach}>
table>
<
div id="miniCalMoreLinks">
<
a href="<{xoAppUrl /modules/qpages/}>">What's On | ">All Events



I have modified the template so it is possible I have messed soemthing up but usually if there is an opening or closing <{if}> missing I usually get a smarty error but there is no errors in this case except when validating.

Thanks for your help and happy new year.

4
playsome
Re: Trying to get extcal minical block template to validate
  • 2011/12/31 20:35

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Just a correction,

the closing DOES NOT show in the page source

<td><a href="http://www.whitlawburncrc.org.uk/calendar/day.php?year=2011&month=12&day=1">1                    td>


the above is a copy/paste from the source code of one of the minical cells with an event, as you can see the closing is missing but it is clearly there in the template so the tag <{if $day.isEvent}> is making the closing a tag not appear for some reason.

5
playsome
Re: Trying to get extcal minical block template to validate
  • 2012/1/1 2:31

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


I think I have finally solved this.

Here is the modifications to the template code and I no longer get any a tag ommitted errors when validating

<td>
                        <{if !
$day.isEmpty}>
                                 <{if 
$day.haveEvents}>
                                         <
a href="<{$xoops_url}>/modules/extcal/day.php?year=<{$weeks.weekInfo.year}>&month=<{$weeks.weekInfo.month}>&day=<{$day.number}>">
                                 
                                 <{
$day.number}>
                                
                                         a>
                                         
                                 <{else}>
                                 <{
$day.number}>        
                                 <{/if}>
                                 
                        <{else}>
                                 &
nbsp;
                        <{/if}>
         td>


Basically i have removed the variable <{if $day.isEvent}> (not sure if that was actually doing anything as it did not seem to return true or false.), extended the if day.isEvents closing if after the closing a tag and added in an extra else statement so if the day has no events but is a calendar day it will display the day number.

Hope this helps someone else out.

6
Peekay
Re: Trying to get extcal minical block template to validate
  • 2012/1/1 16:00

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Glad you solved it.

I applaud your efforts for validation. I have recommended the HTML validator plugin for firefox several times before. It makes validating on localhost easy, highlights potential code errors and has an option to validate using the W3C website too.

Of course if a Smarty variable is grabbing data from the underlying PHP file, you sometimes need to check the PHP script too to see if it is returning some HTML tags in the code as part of an echo statement.

The worst ones IMHO are the loops to create tables. I still have a site that the validator says is missing a closing , but no amount of hair-tearing or cursing would reveal the problem!

These threads may be of some help

About validating quote marks

XO validation errors - and those pesky buttons (my pet hate)



A thread is for life. Not just for Christmas.

7
playsome
Re: Trying to get extcal minical block template to validate
  • 2012/1/1 18:17

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


HI peekay,

I think validation is pretty important, as a computer science student we are always taught to validate our code, although maybe it is not that important (google doesnt validate) but having errors like unclosed tags i just dont like.

I had searched the extcal files for isEvent but could see no reference to it anywhere except the template so im not sure what underlying php code it was getting data from.

that particular smarty tag did seem to not do much it seemed to always return false (i.e not close the tag).

Thanks for the references, i'll take a look at them.

Cheers

8
jjdai
Re: Trying to get extcal minical block template to validate
  • 2012/1/5 18:22

  • jjdai

  • Just popping in

  • Posts: 25

  • Since: 2006/6/17


bonjour:
I did not understand everything, but I'll watch that and integers this new template..

On witch version ha you this problème.

JJDai

Login

Who's Online

300 user(s) are online (195 user(s) are browsing Support Forums)


Members: 0


Guests: 300


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits