Page 1 of 1

[SOLVED] Strange Company Directory page layout issue

Posted: Sat Apr 30, 2011 7:07 pm
by elkman
I have installed the Company Directory and it works well. I have created several categories and subcategories. This worked perfectly.

I have two menu tabs. One showing "Where To Eat" and one showing "Places To Stay". Using the tags: {CompanyDirectory category="Where To Eat"} and {CompanyDirectory category="Places To Stay"} respectively.

I have modified the Summary templates as shown below:

Code: Select all

{if isset($catformstart)}
{$catformstart}
{$catdropdown}{$catbutton}
{$catformend}
{/if}

{if isset($messages)}
<div class="CompanyDirectoryMessage">
 <ul>
   {foreach from=$messages item='one'}
     <li>{$one}</li>
   {/foreach}
 </ul>
</div>
{/if}

{if isset($errors)}
<div class="CompanyDirectoryError">
 <ul>
   {foreach from=$errors item='one'}
     <li>{$one}</li>
   {/foreach}
 </ul>
</div>
{/if}

{if isset($items)}
  <div>
  {$firstlink} {$prevlink}  {$pagetext} {$curpage} {$oftext} {$pagecount}  {$nextlink} {$lastlink}
  </div>

  {foreach from=$items item=entry}
  <div class="CompanyDirectoryItem">
{if $entry->picture_location ne ''}
<img src="{$entry->picture_path}" />
{/if}
<a href="{$entry->detail_url}">{$entry->company_name}</a><br />
{if $entry->details ne ''}
{$entry->details|truncate:200}
<a href="{$entry->detail_url}">read more</a><br />
{/if}
   </div>
  {/foreach}
{/if}
This works exactly as expected on the "Where To Eat" page yet breaks the "Places To Stay" page. If I add another </div> after the last {/foreach} shown above, then the "Places To Stay" page works and the "Where To Eat" page breaks.

Here are links to the respective pages:
Where To Eat: http://www.tellerhomes.com/tellercounty ... ces-to-eat
Places To Stay: http://www.tellerhomes.com/tellercounty ... es-to-stay

Can anyone see what is going wrong? It's really odd because every company is added the same and using the same templates. Why would a company in one category display correctly while a company in another category break the page?

Please help if you can. This one has me stumped. Using Firebug I can see that the entry structure is different between the displayed results even though they are using the same templates.

Elkman

Re: Strange Company Directory issue

Posted: Sat Apr 30, 2011 11:23 pm
by Nullig
Do they both use the same Page template?
Is the content field completed the same for both?

This looks like a problem with the page data or the page template, not the module template.

Nullig

Re: Strange Company Directory issue

Posted: Sat Apr 30, 2011 11:32 pm
by elkman
Yes, everything is exactly the same. I have narrowed it down to this part of the code:

Code: Select all

{if $entry->details ne ''}
{$entry->details|truncate:200}
<a href="{$entry->detail_url}">read more</a><br />
{/if}
If I take this out both pages work the same. But, the whole point was to add detail info into the summary template.

Re: Strange Company Directory issue

Posted: Sat Apr 30, 2011 11:58 pm
by calguy1000
oh come on now... this is so simple.

Hint: Validate your pages

Re: Strange Company Directory issue

Posted: Sun May 01, 2011 5:54 am
by elkman
Well I guess that's just a nice way of calling someone a moron who asked for help.

Just for fun and to kill a few more wasted hours, I converted the original website template into a CMSSimple template. Standard CSS file, standard images, and provided HTML. All completely validated. Same as it was before I began this project. Here is a link to the actual online template which can be validated:

http://www.metamorphozis.com/free_templ ... dex_1.html

I only added the {content} tag to this template. Everything else was left in place so as to make sure validation wasn't affected in any way unless by a CMS Module.

Here is a link to this basic templated CMS site:
http://www.tellerhomes.com/tellercounty ... ge=bubbles

I have added the same Company Directory tags into the {content} of the Place To Stay page and Where To Eat page. In both situations the exact same thing has happened that I originally requested help with.

The Where To Eat page works while the Places To Stay page layout is broken again. Notice the NEWS <div> is moved. In both cases html validation is showing errors caused by the Company Directory module components.

If there isn't a way to fix it that's fine. I just don't usually ask for help until I've exhausted searching the forum, checking the html code and reviewing the css for stupid errors which I know I can miss with my failing eye sight.

If anyone can tell me what may be wrong without wasting very much of their time, that would be very helpful. Again, there's absolutely nothing added to these pages except the Company Directory tags:
{CompanyDirectory category="Where To Eat"}
{CompanyDirectory category="Places To Stay"}

Re: Strange Company Directory issue

Posted: Sun May 01, 2011 8:24 am
by uniqu3
You do know that using truncate also cuts off html tags?
Like here:
<p>A summer vacation at Tarryall River Ranch will never be forgotten! The magnificent Rocky Mountain scenery and the clear Colorado weather combined with great activities and warm hospitality...

As you can see closing </p> is missing, so if i am not wrong strip_tags should resolve your problem.

Code: Select all

{$entry->details|truncate:200|strip_tags:true}

Re: Strange Company Directory issue

Posted: Sun May 01, 2011 3:34 pm
by elkman
No, I didn't know that.

I hadn't used "truncate" until Nicmare was kind enough to recently answer my previous post asking how to limit the Detail text content shown in a summary template used in Company Directory.

Thank you VERY MUCH for this insight. It is very helpful and appreciated!

Elkman

Re: Strange Company Directory issue

Posted: Sun May 01, 2011 4:46 pm
by Dr.CSS
I believe that was what was meant by "Validate your pages" not that you were a moron, if you had a broken page that used the same template but different tags that would be the first thing to do, look in page source to find a missing /close for a div, p or span...

If you break one of those it will throw everything off...

Re: [SOLVED] Strange Company Directory page layout issue

Posted: Sun Jan 15, 2012 11:47 pm
by beherenow_uk
|strip_tags:true
Boom! That just solved my issue!

Thanks Goran.