NetTalk Central

Author Topic: Change jpq depending on a Clarion-variable  (Read 3377 times)

kristofv

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Change jpq depending on a Clarion-variable
« on: May 25, 2012, 05:08:52 AM »
Dear,

Can we change the jpg-file in xhtml defined depending on a Clarion-variable.
The jpg is defined in a browseform and is xhtml-code.

Kind regards,
Kristof

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Change jpq depending on a Clarion-variable
« Reply #1 on: May 25, 2012, 05:12:33 AM »
yes.

if you want a more specific answer, then you'll need to give a more specific case - ie context, what you have in the xHtml and so on...

cheers
Bruce

kristofv

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Change jpq depending on a Clarion-variable
« Reply #2 on: May 25, 2012, 05:44:53 AM »
Bruce,

This the xhtml code on the browse after logging in.  This is in the PageHeaderTag.

<div class="nt-left nt-site-header-logo"><img src="images/logo_wmi.jpg" />

We like to change the jpg depending on a string(1) (in Clarion) depending on the language of the customer when logged in.

Kind regards,
Kristof

kristofv

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Change jpq depending on a Clarion-variable
« Reply #3 on: May 25, 2012, 06:12:31 AM »
Hi Bruce,

This is a screenshot of the current site.
The aim is to only display the legend for one language.  This is in the header and footer.  So we need to use different jpg-files.

Kind regards,
Kristof


[attachment deleted by admin]

kristofv

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Change jpq depending on a Clarion-variable
« Reply #4 on: May 25, 2012, 06:36:18 AM »
Hi Bruce,

Yes we need to use different jpg's.
The problem is that the link is in the xhtml-part.
We need to change these online not depending on the executable but depending on the customer language.  We don't want different exe-files per customer.
Our customers have their customers and they have different languages.  So depending on the end-customer the jpg should be selected.
This means we need depending on a variable (in a tps-file) we need to select.

Kind regards,
Kristof

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Change jpq depending on a Clarion-variable
« Reply #5 on: May 26, 2012, 01:24:42 AM »
Hi Kristof,

There are a couple of things worth mantioning here

>>  We don't want different exe-files per customer.

of course not - that would be insane.

first thing to be aware of is that the xHtml entries come with a "condition". Meaning that if you have 3 cases, it's trivial to put those cases into the condition, and have 3 entries in the xHtml tab. For example, a few of the examples do this with the header. You can have a different header to be displayed if the user is logged in, or logged out.

The second thing of interest here is that your xHtml is very short. So it becomes practical to examine the generated code to see how it is generated. It's basically just a routine, and the routine is called once from the code. From here it's a hop, skip and sneeze to just embedding your own routine (in source code) and making a call to the routine, also from embed code.

The routine is just building a string, so normal Clarion string handling applies - as does normal file handling, so you can easily read the file here, and inject your string into the string is easy.

The last alternative, and the one you probably want to use, is the ability to inject a session value into the HTML. For example;

<div class="nt-left nt-site-header-logo"><img src="<!-- Net:s:someimage -->" />

You could set the session value ("someimage") when the person logs in.

Cheers
Bruce