geojoomla
Total posts: 73
12 Янв 2015 14:44

Hi,

I'm looking for a flexible "scheduling" solution. For example, show article/field: - every Monday (= hide from Tuesday to Sunday) - every evening from 6pm to 10pm (= hide daily from 10:01 to 05:59)

There are some events extensions out there, but was wondering if it can be done with Cobalt articles/fields.

Thanks for any idea/suggestion.

Последние изменения: 06 Фев 2015

Метки Cobalt 9 Fields


Sergey
Total posts: 13,748
13 Янв 2015 12:04

Unfortunately this is not possible in Cobalt.


klox7 VIP
Total posts: 914
14 Янв 2015 10:23

@geojoomla What about custom php in record template. Something like (for fields):

<?php
if (date("D") == "Mon") {
    if (date("H") >= "18" && date("H") < "22") {
        if (isset($item->fields_by_id[ID])) {
            echo $item->fields_by_id[ID]->result;
        }
    }
}
?>

where ID is field id.


Sergey
Total posts: 13,748
15 Янв 2015 09:28

This misght work for fields but not for article. For article we need to ad condition to SQL query so that articles are not even in the list during particular time.


geojoomla
Total posts: 73
15 Янв 2015 18:52

Hmm... but if fields making article are "not there" during a period of time, it means that the article is "empty" during that time, right? Article is still there, but showing just white/no content, if field not shown, right?

If correct, could you help pointing where exactly I should put such php code?

Thanks a lot to kkx7 and Sergey


geojoomla
Total posts: 73
15 Янв 2015 19:00

@kkx7

Oh, I got a bit rusty, :) - you clearly say "in record template". I'll try see how it works. Thanks again


geojoomla
Total posts: 73
04 Фев 2015 14:49

This question here is also interesting, somehow related. I assumed that what @tmatbcorp asks it's not possible either... G


Sergey
Total posts: 13,748
05 Фев 2015 05:28

I'll mark it as idea for Cobalt 9 so that fields affect records list query.


klox7 VIP
Total posts: 914
05 Фев 2015 07:18

geojoomla This question here is also interesting, somehow related. I assumed that what @tmatbcorp asks it's not possible either... G

I think you could remove articles from showing in list with normal field isset, even in the full article (though you can bump on empty pages). If I look at default_list_blog.php the article is inside <article>...</article>.

So if I have field that needs a value for display this article in list I can probably do this

<?php if(isset($item->fields_by_id[ID])): ?> //where ID is field ID
    <article>...</article>
<?php endif; ?>

geojoomla
Total posts: 73
05 Фев 2015 20:06

Thanks for marking the field dependency idea Sergey and for the code @klox7.

To have records ability of being displayed or not, based on field values (and maybe later development on time values) could be useful for all Cobalt users.


geojoomla
Total posts: 73
05 Фев 2015 20:23

Sergey & team...

I just see that "Type" already has a setting called "Auto expire in days".

So, there is a time element: "...article older than 3 days will not be displayed" - the explanation says.

Stupid question: if article already "knows" to hide after 3 days, couldn't it learn from more admin fields to "show up" during a period?

e.g. instead of "Auto expire" - to say

"Auto show during": weekday, hh:mm - weekday, hh:mm

?

Sorry to bother if not possible, just asking...


Sergey
Total posts: 13,748
06 Фев 2015 07:39

This is custom scenario. Right now it is on/off scenario. You either show or not. You have a bit more complex which cannot be implemented through parameters.

Работает на Cobalt