# Agent IF, how to use

**URL:** <https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868>\
**Category:** RapidWeaver Classic\
**Created:** [December 28, 2021, 8:13am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868 "2021-12-28T08:13:14Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![nemo55](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nemo55](https://forums.realmacsoftware.com/u/nemo55)\
**Post date:** [December 28, 2021, 8:13am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/1 "2021-12-28T08:13:14Z")

</div>

Hi

so far, I didn’t find a hint or description how to use @joeworkman 's AGENT IF sub stack which is part of the Agent stack.

Does anybody uses this? And if yes, for what purpose?

I want to publish certain content based on content in another stack (IF condition A is true, show B, ELSE show nothing f.e.). I thought Agent might be able to do that, but I’m not sure.

Thanks for any hint,

Juergen

---

<div class="post-metadata">

**Author:** ![Fuellemann](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/fuellemann/32/22871_2.png) [@Fuellemann](https://forums.realmacsoftware.com/u/Fuellemann)\
**Post date:** [December 28, 2021, 9:14am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/2 "2021-12-28T09:14:27Z")

</div>

Hi, I did this to show a dedicated mobile version of my site to the visitors. It is quite simple and works well.

---

<div class="post-metadata">

**Author:** ![nemo55](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nemo55](https://forums.realmacsoftware.com/u/nemo55)\
**Post date:** [December 28, 2021, 9:48am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/3 "2021-12-28T09:48:13Z")

</div>

Hi Jan

Thanks - I know that, but that’s the usual function of the Agent stack. But what about the AGENT IF sub stack? This demands a PHP condition (e.g. $username == “username”). It’s not clear (for me) how to use it or where to put the condition

Juergen

---

<div class="post-metadata">

**Author:** ![Fuellemann](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/fuellemann/32/22871_2.png) [@Fuellemann](https://forums.realmacsoftware.com/u/Fuellemann)\
**Post date:** [December 28, 2021, 10:18am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/4 "2021-12-28T10:18:34Z")

</div>

Ah sorry. This I do not know. Did yo try to find some answers at weavers space?

---

<div class="post-metadata">

**Author:** ![nemo55](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nemo55](https://forums.realmacsoftware.com/u/nemo55)\
**Post date:** [December 28, 2021, 10:22am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/5 "2021-12-28T10:22:19Z")

</div>

I went through the video tutorials, but it’s not mentioned…

---

<div class="post-metadata">

**Author:** ![dripple](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/dripple/32/20481_2.png) [@dripple](https://forums.realmacsoftware.com/u/dripple)\
**Post date:** [December 28, 2021, 10:51am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/6 "2021-12-28T10:51:19Z")

</div>

The IF stack is not a “publishing” stack, it makes his decisions on runtime, e.g. when the page is loaded. The if conditions are PHP conditions, so e.g. you can check if a URL parameter is set, a session variable or any other you can think of.

Perhaps you can describe a bit more in detail, what you want to archive?

For example, have a look at one of my demo pages: [https://fyle.heiko.codes/](https://fyle.heiko.codes/)

It uses IF conditions in various places, for example:

- If the page is first visited, the header is large and products of the week are displayed
- If the page is displayed from a category search or from changing the page (browsing products), the header is smaller, the products of the weeks are hidden and also the heading changes to the category
- If a parameter `display` is set, it changes the view between tiled and list view
- If you do a search, the heading shows a heading “We found x products of {searchterm}”, otherwise it’s hidden.

---

<div class="post-metadata">

**Author:** ![nemo55](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nemo55](https://forums.realmacsoftware.com/u/nemo55)\
**Post date:** [December 28, 2021, 12:00pm UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/7 "2021-12-28T12:00:23Z")

</div>

Thanks, Heiko.

This makes sense… useful for a number of purposes. However, not 100% what I was looking for.

Meanwhile, I’ve chosen to use @willwood 's WebYep Boolean stack allowing to display or hide almost any content stack without opening RW. It still needs some manual work but done quickly.

My purpose: I want to hide a calendar list view pulled from a Google calendar if no events are taking place. Otherwise, a list of all events are shown.

Best

Juergen

---

<div class="post-metadata">

**Author:** ![dripple](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/dripple/32/20481_2.png) [@dripple](https://forums.realmacsoftware.com/u/dripple)\
**Post date:** [December 28, 2021, 1:52pm UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/8 "2021-12-28T13:52:05Z")

</div>

> [@nemo55](#):
>
> I want to hide a calendar list view pulled from a Google calendar if no events are taking place. Otherwise, a list of all events are shown.

Ah, got it.

What Stack are you going to use with Google calendar?

---

<div class="post-metadata">

**Author:** ![nemo55](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nemo55](https://forums.realmacsoftware.com/u/nemo55)\
**Post date:** [December 28, 2021, 2:40pm UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/9 "2021-12-28T14:40:17Z")

</div>

I don’t use a stack for the Google calendar. The one(s) that exist are either somewhat clumsy or development had been stopped… a pity.

I use a Google calendar script ([http://www.kacurak.com/formatgooglecalendar/example.html](http://www.kacurak.com/formatgooglecalendar/example.html)) which I modified to my needs. It creates a simple event list, sufficient for the purposes I need. There are other scripts around so far I saw, but I did not use them yet.

Juergen

---

<div class="post-metadata">

**Author:** ![joeworkman](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/joeworkman/32/23780_2.png) [@joeworkman](https://forums.realmacsoftware.com/u/joeworkman)\
**Post date:** [December 28, 2021, 4:54pm UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/10 "2021-12-28T16:54:35Z")

</div>

So the Agent if stack requires that you are familiar with PHP code. It allows you to build logic based on PHP variables that you or some software has created on the page. Agent started as a server visibility stack but it’s really turned into a Swiss army knife of server side utilities. But the core is still mostly about showing and hiding data at the server level.

---

<div class="post-metadata">

**Author:** ![nemo55](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nemo55](https://forums.realmacsoftware.com/u/nemo55)\
**Post date:** [December 28, 2021, 5:17pm UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/11 "2021-12-28T17:17:54Z")

</div>

Hi, Joe

Thanks a lot. I managed to get it work - though it’s not exactly what I was looking for. I will further explore the options and possibilities.

Best

Juergen

---

<div class="post-metadata">

**Author:** ![nemo55](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nemo55](https://forums.realmacsoftware.com/u/nemo55)\
**Post date:** [December 29, 2021, 9:46am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/12 "2021-12-29T09:46:13Z")

</div>

For those who are interested…

I installed the following solution for which I use:

- Joe’s @joeworkman Agent stack (Agent if sub stack)

- Jannis’ @instacks repository stack

- the Agent IF sets the PHP statement for when a certain content is shown, or in case an alternative content.

- the prefix of the concerned RW page includes a txt file containing the necessary PHP code

- the repository stack allows to edit the txt file (other option might be DropCMS, I guess) according to my needs

With this, I am able to toggle the content as needed.

This still is not a fully automatic solution but does not need to open the RW project.

Best, Juergen

---

<div class="post-metadata">

**Author:** ![dripple](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/dripple/32/20481_2.png) [@dripple](https://forums.realmacsoftware.com/u/dripple)\
**Post date:** [December 29, 2021, 10:12am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/13 "2021-12-29T10:12:05Z")

</div>

Just a random thought: you can also use Google docs / sheets for configuring websites / content of websites.

Just an example, this little order site uses Google sheets for displaying the food menu (via LiveData Stack) and a custom condition stack to hide the order form once the configured maximum number of orders has come in:

[https://gabs.kitchen](https://gabs.kitchen)

You can play around on my kitchensink:  
[https://kitchensink.heiko.codes/slots/](https://kitchensink.heiko.codes/slots/)

---

<div class="post-metadata">

**Author:** ![nemo55](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nemo55](https://forums.realmacsoftware.com/u/nemo55)\
**Post date:** [December 29, 2021, 12:17pm UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/14 "2021-12-29T12:17:24Z")

</div>

Hi Heiko

True, that’s an option - as well as GSheet from Weavium which has an IF option, too. However, the client needs to have / accept having a Google account 😉

Juergen

---

<div class="post-metadata">

**Author:** ![joeworkman](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/joeworkman/32/23780_2.png) [@joeworkman](https://forums.realmacsoftware.com/u/joeworkman)\
**Post date:** [December 29, 2021, 4:56pm UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/15 "2021-12-29T16:56:47Z")

</div>

I have to put my 2¢ on website content on Google sheets. This is such a horrible idea! This makes me cringe every time I see someone doing it. You do not want to rely on any web service to be up in order to supply critical data for your site content to work. This is especially true with Google. It’s not a matter of “if” but “when” this will break your website.

You also have to think about performance and SEO implications of this as well.

---

<div class="post-metadata">

**Author:** ![nemo55](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nemo55](https://forums.realmacsoftware.com/u/nemo55)\
**Post date:** [December 29, 2021, 5:40pm UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/16 "2021-12-29T17:40:33Z")

</div>

🙂 Hi Joe… agree, I would never rely on G for an entire web site, especially for a client. You can be sure to be flooded with support requests.

However, for a single case, these options might be a solution without too much effort. In my case, I am fully in control of the web site concerned.

All the best for the new year

Juergen

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/system/32/25301_2.png) [@system](https://forums.realmacsoftware.com/u/system)\
**Post date:** [January 29, 2022, 3:40am UTC](https://forums.realmacsoftware.com/t/agent-if-how-to-use/41868/17 "2022-01-29T03:40:34Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
