Problems, need help? Have a tip or advice? Post it here.
23 posts Page 3 of 3
KK wrote: @atisz, I'd suggest you please make things easier for yourself by breaking up the code in manageable chunks.
The key part in your code is the following statement -
Code: Select all
<cms:pages masterpage='members/template-name.php' custom_field="page_hits=0" show_future_entries='1' count_only='1' /> 

Capture its output into a variable for using later on as follows -
Code: Select all
<cms:capture into='my_count'><cms:pages masterpage='members/template-name.php' custom_field="page_hits=0" show_future_entries='1' count_only='1' /></cms:capture>

As you can see above, we simply wrapped <cms:capture> immediately around the original code.

And now the rest of the code should become easier to understand (and debug if necessary) -
Code: Select all
<li>
<a href="template-name.php">MENU OPTION
    <cms:if my_count gt '0' >     
        <em><cms:show my_count /></em>
    </cms:if>
</a>
</li>

Hope this helps.


Thank you KK! That way it is a lot easier to understand the code ;) I always tend to overcomplicate things, especially when I'm trying to do new things. Finally, I managed to solve both of the IF statements that wasn't working as expected before.
Thanks again!

Regards,
Attila
trendoman wrote:
Hope this helps.

Sure it does, @KK :) Complex statements always get messy with an acid mixture of double and single quotes.

@atisz, In that sample of yours, double quote inside cms:pages was considered as end of cms:if condition. The rest of the string was therefore correctly disrespected by CMS. It was considered as wrong syntax, which you saw in error messages.


Thanks trendoman for the info. I suspected that the problem should come because of double quote or bracket, so I have tried a lot of combinations with or without theme, but in the end I managed by myself only to produce the results mentioned in my yesterday's post.
Implementing KK suggestions solved the problem and now the warnings and menu notifications are both working as expected.
Thank you guys for the help, without you I wouldn't be able to find a solution for these problems.

Attila
Hi guys! I want to set up another warning, now the approach is a little different. The user can submit a form which contains:
1. A starting date = page's publish date
Code: Select all
<cms:db_persist_form
                    _invalidate_cache='0'
                    _auto_title='1'
                    k_publish_date=frm_my_datetime
                    ............
                />
2. The period of warranty in years
Code: Select all
<cms:editable name='warranty' label='Select warranty' required='1' type="dropdown" opt_values="select amount in years=- | 1 | 2 | 3 | 4 | 5" />
What I need to achieve is to get a warning message displayed 15 days before the warranty expires.
Is there a way to achieve this?
Thanks!
23 posts Page 3 of 3
cron