{SOLVED} CG Cal - list weirdness

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
dmagill
Forum Members
Forum Members
Posts: 165
Joined: Thu Nov 15, 2007 6:55 pm

{SOLVED} CG Cal - list weirdness

Post by dmagill »

Hey all,

I could be doing something wrong here, and it would not be the first time.

http://vsgroupdev.com/newchief/index.ph ... s-calendar

This is my site that I am currently working on. It's just a bunch of divs held together by bubble gum and ductape.

When I installed the list everything went fine. I have worked with the list before and had no problems. Although those sites used tables to hold themselves together.

The problem seems to be once I added my second event, it kicked the bottom menu out of place, and looks like it was not closed correctly so the list absorbed the bottom menu and pulled it out of place. I had to add divs to the bottom of the Blog-post-list template, 13 of them to be exact. I have added a picture as a sample.

I worry that my clients will have to add divs for each additional entry, and that is bad, nice people, no tech.

I tested my others pages thinking I didn't close everything but so far my code is fairly clean.

The CMS got installed April 12.
CMS: 1.10.3
CGCalendar 1.9.4
PHP: 5.1.14
LAMP
MYSQL: 5.0.92
I have all green checkboxes

I edited the template after I figured out that I had to add the divs to the bottom. I just removed the Next and Previous arrows to go to the past and next year.

My Current Code

Code: Select all

<div class="calendar-list" id="{$table_id}">
{if $compact_view neq 1}


<h1>Events Lising</h1>
{/if}
{foreach from=$events key=key item=event}
	<div class="calendar-event">
	<div class="listentryvs"><h2>{$event.event_title}</h2>

	{assign var=month_number value=$event.event_date_start|date_format:"%m"}
	{assign var=end_month_number value=$event.event_date_end|date_format:"%m"}

	<div class="calendar-date-from"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"}



	{if $event.event_summary !="" && ($detail != 1 || ($event.event_details =="" ||  $event.event_details == "<br />"))}
		<div class="calendar-summary"><span class="calendar-summary-title">{$lang.summary}: </span>{$event.event_summary}</div>
	{/if}
	{if $detail == 1}
		{if $event.event_details !="" && $event.event_details != "<br />"}
		<div class="calendar-details"><span class="calendar-details-title">{$lang.details}: </span>{$event.event_details}</div>
		{/if}
	{else}
		<a href="{$event.url}">{$moretext}</a>
	{/if}
</div></div>
	
{/foreach}

{if $return_url != ""}
<div class="calendar-returnlink">{$return_url}</div>
{/if}
</div></div></div></div></div></div></div></div></div></div></div></div></div>

 

Thank you as always, and please let me know what I am doing wrong.
Attachments
Without additional divs.
Without additional divs.
Last edited by dmagill on Thu Apr 19, 2012 5:59 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12710
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: CG Cal - list weirdness

Post by Dr.CSS »

Looks ok to me...
dmagill
Forum Members
Forum Members
Posts: 165
Joined: Thu Nov 15, 2007 6:55 pm

Re: CG Cal - list weirdness

Post by dmagill »

Thanks for taking a look doc.

I will add another entry so you can see what is happening. I will not modify the list template.

http://vsgroupdev.com/newchief/index.ph ... s-calendar

I am working on another page, if you have a moment have a look and let me know.

Have a great day.
Mieszko
Forum Members
Forum Members
Posts: 59
Joined: Fri Mar 04, 2011 2:40 pm

Re: CG Cal - list weirdness

Post by Mieszko »

...hmmm
do you really use that template code posted above?

then there are too many closing divs in the last row.

this is your last row:

Code: Select all

</div></div></div></div></div></div></div></div></div></div></div></div></div>
delete all but two of those divs.
See what happens then.

Tip: just do a simple count: you have opened 7 divs and closed 18. That can't work.


and there seems to be a typo in line 9 of that code:
<div class="listentryvs"><h2>{$event.event_title}</h2>

maybe that causes some trouble, too
dmagill
Forum Members
Forum Members
Posts: 165
Joined: Thu Nov 15, 2007 6:55 pm

Re: CG Cal - list weirdness

Post by dmagill »

Hey Mieszko,

Those divs are the only way I can get the template to work properly. Currently I am missing one div to make the page layout properly. Which would put me at 14 divs.

If I remove the divs the page will stay broken. If I add the missing div the page will correct itself.

Thanks.
dmagill
Forum Members
Forum Members
Posts: 165
Joined: Thu Nov 15, 2007 6:55 pm

Re: CG Cal - list weirdness

Post by dmagill »

Sorry, reading to fast.

listentryvs - I added that. I work for a company with the first initials VS. So I tend to use it in places that I have added things.
Mieszko
Forum Members
Forum Members
Posts: 59
Joined: Fri Mar 04, 2011 2:40 pm

Re: CG Cal - list weirdness

Post by Mieszko »

it can't be that you have to close a bunch of divs that you've never opened. There must be somethin wrong elsewhere then.

I've copied the sourcecode of the above posted link from Firefox to my editor ( assuming Firefox shows it correctly).

When I walk through your code it says that there are unmatched open divs
like
<div class="outerwrapper">
<div class="innerlining">

those are opened but not closed.
Maybe it helps to close them at the appropriate places.

Just an idea...
dmagill
Forum Members
Forum Members
Posts: 165
Joined: Thu Nov 15, 2007 6:55 pm

Re: CG Cal - list weirdness

Post by dmagill »

@Mieszko

True, but... the infamous but, if I look at one of my other pages, the code is clean. And I am using the same template for all the pages except the landing/splash page.

If I had bad code on that page, would I not have it on the others?
The only page that comes up with an error is the page with the list.

That is what is confusing me. If I remove the list element the page works fine, add the list back and it takes control of the bottom menu again. But the errors go away.

so weird.
Mieszko
Forum Members
Forum Members
Posts: 59
Joined: Fri Mar 04, 2011 2:40 pm

Re: CG Cal - list weirdness

Post by Mieszko »

yes, you're right ....
my fault.

in that Calendar template...
<div class="calendar-event">

needs to be closed within the foreach loop.
so adding one more </div> before the closing foreach should work *hope*

Sorry didn't see that before.
dmagill
Forum Members
Forum Members
Posts: 165
Joined: Thu Nov 15, 2007 6:55 pm

Re: CG Cal - list weirdness

Post by dmagill »

@Mieszko

Thanks for staying with me.

I broke the page so people could see it in action.

My problem is, the clients are far from computer savvy. I am worried that they will add more events, and they will, at least 6 more, and the page will brake on them.

In the end, adding the patch is not really going to help me. I am certain I will be getting 4 am phone calls, frantic voice echoing across my eardrum, the site is broken!

And that is bad.

Again, I am not certain if I found a bug :-\ or I have missed an entire step. I am leaning to the latter.

Thanks again.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Re: CG Cal - list weirdness

Post by paulbaker »

Looks to me like your template code is missing a </div>

Try putting one after this bit:

Code: Select all

<div class="calendar-date-from"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"}
Each time the foreach runs you get a starting <div> without a finishing </div>. Therefore at the end you need the same number of </div>s as you have events.

Putting the </div> in the template as I describe above should solve the problem.
dmagill
Forum Members
Forum Members
Posts: 165
Joined: Thu Nov 15, 2007 6:55 pm

Re: CG Cal - list weirdness

Post by dmagill »

Thanks Paul,

I did as you asked, and removed all the divs and placed the one at that end location. I double checked to make sure it was in the right place. This time it prematurly ended my text layout, but everything else was in alignment. Palm to head.

As I am running out of time, and I am certain it is something I did, I have set the Sample as default and so far so good.
http://vsgroupdev.com/newchief/index.ph ... s-calendar

I will be trying to edit this but will back up the original code and remove the more links and the like. At least I know that at this very moment the little bugger works correctly. It is all up to me to brake it now.

I am going to leave this open for the day and then if I have no problems will close it.

Thank you to everyone that took the time to help me out. Awesome guys!
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12710
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: {SOLVED} CG Cal - list weirdness

Post by Dr.CSS »

The problem with the code/template you posted is that it is missing a closing </div>...

<div class="calendar-date-from"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"}

So every time it uses this it needs another </div> at the end of the template...
Mieszko
Forum Members
Forum Members
Posts: 59
Joined: Fri Mar 04, 2011 2:40 pm

Re: {SOLVED} CG Cal - list weirdness

Post by Mieszko »

addendum:
The complete template should work like so:

Code: Select all

<div class="calendar-list" id="{$table_id}">
{if $compact_view neq 1}


<h1>Events Lising</h1>
{/if}
{foreach from=$events key=key item=event}
   <div class="calendar-event">
   <div class="listentryvs"><h2>{$event.event_title}</h2>

   {assign var=month_number value=$event.event_date_start|date_format:"%m"}
   {assign var=end_month_number value=$event.event_date_end|date_format:"%m"}

   <div class="calendar-date-from"><span class="calendar-date-title">{$lang.date}: </span>{$event.event_date_start|date_format:"%e"} {$month_names[$month_number]} {$event.event_date_start|date_format:"%Y %H:%M"}



   {if $event.event_summary !="" && ($detail != 1 || ($event.event_details =="" ||  $event.event_details == "<br />"))}
      <div class="calendar-summary"><span class="calendar-summary-title">{$lang.summary}: </span>{$event.event_summary}</div>
   {/if}
   {if $detail == 1}
      {if $event.event_details !="" && $event.event_details != "<br />"}
      <div class="calendar-details"><span class="calendar-details-title">{$lang.details}: </span>{$event.event_details}</div>
      {/if}
   {else}
      <a href="{$event.url}">{$moretext}</a>
   {/if}
</div></div>
</div>
   
{/foreach}

{if $return_url != ""}
<div class="calendar-returnlink">{$return_url}</div>
{/if}
</div>
hope this is helpful to s.b.
Post Reply

Return to “Modules/Add-Ons”