Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Variables in HTML Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 02 2004 at 08:07 | IP Logged Quote TonyNo

Is there another way to use variables to make this easier to change? I want to use them for the house code and unit code, and, don't want to use a Javascript var with document.write. The escaped quotes required will drive me mad!


<% case(ph_getx10stat("A",8) when 0 then "?" when 1 then '<img border="0" src= "/off.gif">' when 2 then case( round(ph_getx10level("A",8),0) when 0 then '<img border="0" src= "/dim.gif">' when 100 then '<img border="0" src= "/on.gif">' else "L:" + string(round(ph_getx10level("A",8),0)))) %> </font>
<input type="button" value="On" onclick="sk('ph_rtne( ph_x10( 1, \'A\', 8, 0) + ph_x10( 1, \'A\', 102, 0))')">
     
<img border="0" alt="Mute" src= "/volume_01.gif" onclick="dimac('A8', 0);"><img border="0" alt="13%" src= "/volume_02.gif" onclick="dimac('A8', 13);"><img border="0" alt="25%" src= "/volume_03.gif" onclick="dimac('A8', 25);"><img border="0" alt="38%" src= "/volume_04.gif" onclick="dimac('A8', 38);"><img border="0" alt="50%" src= "/volume_05.gif" onclick="dimac('A8', 50);"><img border="0" alt="63%" src= "/volume_06.gif" onclick="dimac('A8', 63);"><img border="0" alt="76%" src= "/volume_07.gif" onclick="dimac('A8', 76);"><img border="0" alt="89%" src= "/volume_08.gif" onclick="dimac('A8', 89);"><img border="0" alt="100%" src= "/volume_09.gif" onclick="dimac('A8', 100);"> <input type="button" value="Off" onclick="sk('ph_rtne( ph_x10(1, \'A\', 8, 0) + ph_x10( 1, \'A\', 103, 0))')">
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 02 2004 at 12:44 | IP Logged Quote dhoward

Tony,

Ive been looking at your post and Im not quite sure what you are asking. But if I were to take a stab at it, wouldnt the below work:

<% case(ph_getx10stat("[LOCAL1]",[LOCAL2]) when 0 then "?" when 1 then '<img border="0" src= "/off.gif">' when 2 then case( round(ph_getx10level("[LOCAL1]",[LOCAL2]),0) when 0 then '<img border="0" src= "/dim.gif">' when 100 then '<img border="0" src= "/on.gif">' else "L:" + string(round(ph_getx10level("[LOCAL1]",[LOCAL2]),0)))) %> </font>
<input type="button" value="On" onclick="sk('ph_rtne( ph_x10( 1, \'<%"[LOCAL1]"%>\', <%[LOCAL2]%>, 0) + ph_x10( 1, \'<%"[LOCAL1]"%>\', 102, 0))')">
     
<img border="0" alt="Mute" src= "/volume_01.gif" onclick="dimac('<%"[LOCAL1][LOCAL2]"%>', 0);"><img border="0" alt="13%" src= "/volume_02.gif" onclick="dimac('<%"[LOCAL1][LOCAL2]"%>', 13);"><img border="0" alt="25%" src= "/volume_03.gif" onclick="dimac('<%"[LOCAL1][LOCAL2]"%>', 25);"><img border="0" alt="38%" src= "/volume_04.gif" onclick="dimac('<%"[LOCAL1][LOCAL2]"%>', 38);"><img border="0" alt="50%" src= "/volume_05.gif" onclick="dimac('<%"[LOCAL1][LOCAL2]"%>', 50);"><img border="0" alt="63%" src= "/volume_06.gif" onclick="dimac('<%"[LOCAL1][LOCAL2]"%>', 63);"><img border="0" alt="76%" src= "/volume_07.gif" onclick="dimac('<%"[LOCAL1][LOCAL2]"%>', 76);"><img border="0" alt="89%" src= "/volume_08.gif" onclick="dimac('<%"[LOCAL1][LOCAL2]"%>', 89);"><img border="0" alt="100%" src= "/volume_09.gif" onclick="dimac('<%"[LOCAL1][LOCAL2]"%>', 100);"> <input type="button" value="Off" onclick="sk('ph_rtne( ph_x10(1, \'<%"[LOCAL1]"%>\', <%[LOCAL2]%>, 0) + ph_x10( 1, \'<%"[LOCAL1]"%>\', 103, 0))')">

Ive used [LOCAL1] for the housecode and [LOCAL2] for the unitcode.

Let me know if Im way off base,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 02 2004 at 16:45 | IP Logged Quote TonyNo

Yes, that is a better way! Smack me for not seeing the forest for the trees!

This won't conflict with anything else that uses LOCAL's, right? This would be a LOCAL for what?
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 02 2004 at 17:22 | IP Logged Quote TonyNo

In case you were wondering, this is part of what I am doing...

Current Project
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 02 2004 at 18:33 | IP Logged Quote dhoward

Nope, shouldnt conflict. When a PSP page is executed it gets its own copy of fresh local and temp variables. They will persist for every formula within that page so you'll want to initialize them towards the top of the page probably.

You cant directly pass values into the variables of the PSP page but you can call the page with parameters. Something like: http://yourip/yourpage?hc=A&uc=8

You can then use the ph_getwebparm function within the PSP page to access these parameters and assign them to the local variables.

BTW,

The sample looked awesome. I would love to see the finished product. Very slick.

Dave.


Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 02 2004 at 20:02 | IP Logged Quote TonyNo

Good to know about the local and temp variables.

Thanks! I'll post more as it develops.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum