NetTalk Central

Author Topic: CSS Condition  (Read 4975 times)

rupertvz

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
    • Email
CSS Condition
« on: March 30, 2022, 03:36:36 AM »
Hi Guys,

I would like to set a CSS condition based on a Cookie value saved by NetTalk.

Has anyone done this, or have an example?

Thanks in advance!

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: CSS Condition
« Reply #1 on: April 03, 2022, 10:29:46 PM »
Hi Rupert,

I'm not sure I understand what you have in mind here. Perhaps explain in more detail?
It's not even clear if you want to write Clarion code or JavaScript code to do this.

Cheers
Bruce

rupertvz

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
    • Email
Re: CSS Condition
« Reply #2 on: April 04, 2022, 06:16:34 AM »
Hi Bruce,

I have style sheets in a CSS file for my site.

1.  I want to be able to set a Cookie value via my NetTalk application.

2.  The CSS should then be able to read the Cookie (set by my application) and based on that - apply the correct CSS formatting.



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: CSS Condition
« Reply #3 on: April 05, 2022, 03:29:57 AM »
>> The CSS should then be able to read the Cookie

As far as I'm aware, the CSS language has no ability to read cookies. So you will need to adopt another approach. (Since you don't mention what the _actual_ problem is, I can't suggest which approach would be best.)

I recommend you explain what your actual problem is, rather than search for advice on your proposed solution.

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: CSS Condition
« Reply #4 on: April 06, 2022, 09:04:40 AM »
What about to change the CSS served by the browser based on a conditon?
if condition then Custon.css else Custon2.css end
Is that possible?
Regards
-----------
Regards
Alberto

Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: CSS Condition
« Reply #5 on: April 06, 2022, 11:34:11 AM »
What about to change the CSS served by the browser based on a conditon?
if condition then Custon.css else Custon2.css end
Is that possible?
Regards

Do you mean similar to what you can do by using the url http://127.0.0.1:88/?_theme_=morris

I'd guess you could do something in p_web.ChangeTheme in the web handler

IF get some value from cookie = blarg then   p_web.SetSessionValue('_theme_','blargTheme') .

??


rupertvz

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
    • Email
Re: CSS Condition
« Reply #6 on: April 06, 2022, 11:53:51 AM »
Hi Bruce,

I have a list of "Large Buttons" on my index page.
I would like to show the last button clicked in a different CSS style, say "blue" button.

Thus setting a cooking with the "value" of the last button clicked, then apply the CSS style for the particular button based on the cookie value.

As an alternative, I can probably create a duplicate of each button (with a different CSS style), and hide the second one for each button set initially.  Only showing the "second" button of a set when that set was last clicked.

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 431
    • View Profile
    • Email
Re: CSS Condition
« Reply #7 on: April 07, 2022, 01:44:16 AM »
Hi

I would add this in the "Button CSS Class": choose(p_web.GetValue('myCookie')='xx',' class1',' class2')

/Niels

rupertvz

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
    • Email
Re: CSS Condition
« Reply #8 on: April 07, 2022, 02:14:18 AM »
Thank you Niels,

This is what I was looking for,
Thus the CSS class is able to read the Cookies.

Regards
Rupert