Agent IF, how to use

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

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

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

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

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

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/

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.

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

Ah, got it.

What Stack are you going to use with Google calendar?

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) 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

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.

1 Like

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

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

3 Likes

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

You can play around on my kitchensink:
https://kitchensink.heiko.codes/slots/

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 :wink:

Juergen

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.

2 Likes

:slightly_smiling_face: 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

1 Like

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