Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi all!

I'm working on a site for a Dutch company, and i'm currently finishing the job offers page. The way the company is going to add job offers is by creating a page for each job on a clonable page (vacature.php). If there are job offers, they will be listed on vacatures.php. If there are no job offers, the list should say something in the lines of 'No job offers available'. This is where it gets hard for me, so maybe someone can help me. I've tried a lot of things.

This is the code right now, but the No job offers available is always showing.
Code: Select all
<cms:pages masterpage='vacature.php' paginate='1' limit='10' >
<h4><a href='<cms:show k_page_link />'><cms:show k_page_title /> <small><cms:show vacature_uren /></small></h4></a>
<cms:else />
<p>No job offers available.</p>
</cms:pages>


I guess I should use a <cms:if> but I can't find out which one. Can someone point me in the right direction? Thanks in advance!

Jan
hi there, I have done something similar and used a count:

Code: Select all
<cms:set event_count='0' />   

<cms:pages masterpage='diary.php' show_future_entries='1' start_on=start_date stop_before=stop_date order=events_order >
   <cms:incr event_count '1' />
   
   <li>
      <h2><cms:show k_page_title /></h2>
      <cms:if "<cms:not_empty event_subheading />"><h2 class="extra-info"><cms:show event_subheading /></h2></cms:if>
      <h3><cms:if "<cms:not_empty alternative_date />"><cms:show alternative_date /><cms:else /><cms:if k_page_date lt '2011-01-01' ><cms:date k_page_date format='F Y'/><cms:else /><cms:date k_page_date format='j F Y'/></cms:if></cms:if><cms:if event_time != '00:00' ><span> at <cms:date event_time format='g.ia'/></span></cms:if></h3>
      <cms:if "<cms:not_empty event_details />"><cms:show event_details /></cms:if>
      <cms:if "<cms:not_empty event_footnote />"><cms:show event_footnote /></cms:if>                  
   </li>   
   
</cms:pages>

<cms:if event_count eq '0' >
   <h2>The diary will be updated soon!</h2>
</cms:if>   


No doubt there are other ways of handling this - but it works great for me!
potato wrote: hi there, I have done something similar and used a count:

Code: Select all
<cms:set event_count='0' />   

<cms:pages masterpage='diary.php' show_future_entries='1' start_on=start_date stop_before=stop_date order=events_order >
   <cms:incr event_count '1' />
   
   <li>
      <h2><cms:show k_page_title /></h2>
      <cms:if "<cms:not_empty event_subheading />"><h2 class="extra-info"><cms:show event_subheading /></h2></cms:if>
      <h3><cms:if "<cms:not_empty alternative_date />"><cms:show alternative_date /><cms:else /><cms:if k_page_date lt '2011-01-01' ><cms:date k_page_date format='F Y'/><cms:else /><cms:date k_page_date format='j F Y'/></cms:if></cms:if><cms:if event_time != '00:00' ><span> at <cms:date event_time format='g.ia'/></span></cms:if></h3>
      <cms:if "<cms:not_empty event_details />"><cms:show event_details /></cms:if>
      <cms:if "<cms:not_empty event_footnote />"><cms:show event_footnote /></cms:if>                  
   </li>   
   
</cms:pages>

<cms:if event_count eq '0' >
   <h2>The diary will be updated soon!</h2>
</cms:if>   


No doubt there are other ways of handling this - but it works great for me!


Thanks a lot! Works perfectly indeed! The site is finished now :)

If anyone is intrested, this is the result:
Code: Select all
<cms:set event_count='0' />   
<cms:pages masterpage='vacature.php' paginate='1' limit='10' >
<cms:incr event_count '1' />
<h4><a href='<cms:show k_page_link />'><cms:show k_page_title /> <small><cms:show vacature_uren /></small></a></h4>
</cms:pages>
<cms:if event_count eq '0' >
<p>Er zijn momenteel geen openstaande vacatures.</p>
</cms:if>
Another method of pulling off the same thing would be using the 'cms:no_results' tag
Code: Select all
<cms:pages ..>
   ...
   
   <cms:no_results>
      <h3>No pages found</h3>
   </cms:no_results>
</cms:pages>

So now the original code would become
Code: Select all
<cms:pages masterpage='vacature.php' paginate='1' limit='10' >
    <h4><a href='<cms:show k_page_link />'><cms:show k_page_title /> <small><cms:show vacature_uren /></small></h4></a>

    <cms:no_results>
        <p>No job offers available.</p>
    </cms:no_results>
</cms:pages>

Hope this helps.
4 posts Page 1 of 1
cron