Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: MS Frontpage 2002 & PSP files Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: June 19 2006 at 22:52 | IP Logged Quote smarty

EXTREME NEWBIE QUESTION:
Ok, I am just learning about using MS Frontpage 2002 (taking an online class). I have been able to use Frontpage templates to make a "test" web page and then to save it under the PH web directory. I can even get PH to display/serve it (wow...big deal for me).

However, I have no idea how to "connect" buttons that I create in Frontpage to PH macros, formula's, triggers etc. I have found some example PSP pages (supplied by Dave in a 2005 thread) but they do not seem to import properly into Frontpage 2002 (I was hoping to see how they were made by looking at them through the different views Frontpage offers). Looking at straight HTML is geek to me (since Frontpage makes it for me).

Can anyone point me in the right direction?

Thanks.

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 20 2006 at 00:28 | IP Logged Quote dhoward

Smarty,

You most likely wont be able to work directly with PSP pages in Frontpage (primarily because it probably wouldnt understand the file extension). If you were to rename a PSP to HTM, then Frontpage would probably open it but may choke on the PowerHome PSP code since it will probably try to interpret it as ASP.

Keep in mind that you do not NEED to do PSP in order to have webpages with buttons that control PowerHome. You can have Frontpage make a complete webpage with a "form" (usually the way you would make buttons) and then have the form "action" just make a call to one of the standard PowerHome "ph-cgi" functions. A good way to initially get started with this would be to bring up say the main Device Status webpage and do a "View Source" to see the HTML code and the actual "ph-cgi" calls. This is how I would first start out rather than jumping straight into PSP. You could make some nice webpages to control ALL aspects of PowerHome just by using straight HTML.

PSP is necessary when the webpage being displayed needs to show some "dynamic" data from PowerHome. By dynamic, I mean that the data can be constantly changing such as TonyNo's WinAmp control where the current playing title is displayed along with the "next" title. Since these values are changing and not always the same, you need the PSP to handle this "dynamic" text. If you wanted to create a Winamp control screen that did not display the current song and merely had buttons for play, pause, stop, prev, and next, then you can do that in plain HTML.

With PSP, you have regular HTML just as you did before with PowerHome "formulas" sprinkled in. When the webpage is "served" up, the formulas are evaluated and converted into HTML. What the webbrowser sees then is just HTML and only the PowerHome webserver ever see's the PSP.

Hope this helps a little.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: June 20 2006 at 22:12 | IP Logged Quote smarty

Baby Steps......Thanks, your reply helps (kind of).

Ok, a web look up tells me that "CGI" functions are "Common Gateway Interface" functions that allow web based software to pass information back and forth from non web based software (or something close to that).

More baby steps.... I have opened a COMPLETELY black sheet in MS Frontpage. I then insert a "form" that has three push buttons. The HTML looks like this:
+++++++++++++++++++++++++++++++++++++++++++++++++++++
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><p>
<input type="button" value="Button" name="B3"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>
++++++++++++++++++++++++++++++++++++++++++++++++++++++

What do I do to make any one of these buttons control a macro/button/formula/anything in PH? I would guess that I would click on the button and open the properties box and assign a "link" to the button. Where would the link be assigned? I know I need to use "/ph-cgi/" .....but where and how?




__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 23 2006 at 22:25 | IP Logged Quote dhoward

Smarty,

A couple of useful ph-cgi functions are:

/ph-cgi/playmacro
/ph-cgi/execformula

You can pretty much do anything with just these to functions. You are correct in that CGI is "Common Gateway Interface". In PowerHome, it just means that were going to call a "built-in" function of the webserver rather than serving up a static webpage (HTML file).

You could type the following into the URL field of your browser and it would directly execute the macro:

http://127.0.0.1/ph-cgi/playmacro?id=YOURMACROID&nexturl=/ph -cgi/blank

If we break this down, we can see that it's a ph-cgi function and the function is "playmacro". This function takes two parameters, ID which is the macro ID you wish to play and NEXTURL which is the webpage to load after the macro is played. In this case, it's another ph-cgi function that loads a blank webpage.

Now, to apply this to an HTML form, we can do the following:

Code:

<form method="get" action="/ph-cgi/playmacro">
<input type="hidden" name="id" value="YOURMACROID">
<input type="hidden" name="nexturl" value="/ph-cgi/blank">
<input type="submit" value="The Name of the Button">
</form>


We've basically applied the same thing in the form of an HTML form with a single button. We could duplicate this code above for multiple buttons just changing the "YOURMACROID" to whatever macro ID you wish to execute and the value of the submit button to whatever you wish the button to say.

In the sample code you've posted above, you have 3 different types of buttons. One is a "button" type which can certainly be used but would require a bit more code including some Javascript. The second one is a "submit" button which is the same type I used in my example and requires the least amount of code. The third button you have is a "reset" button. This is a special button for an HTML form that would not be typically used to trigger an action like the "submit" button does. The purpose of the "reset" button is to clear input fields within the same form that the button exists. In the sample you've posted, it would really have no purpose since you don't have any "input" form fields.

Hope this helps a little more,

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: June 23 2006 at 22:29 | IP Logged Quote TonyNo

Is execformula new? I've been using evalfomula.
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: June 23 2006 at 23:47 | IP Logged Quote dhoward

Tony,

Acckkk!! No. /ph-cgi/evalformula is correct. Execformula is wrong. Guess my memory is just going .

Thanks for catching this for me.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: July 12 2006 at 22:59 | IP Logged Quote smarty

I am learning a bit more about HTML in my online class... but I would like to ask about the use of:

/ph-cgi/playmacro
/ph-cgi/evalformula

in a .PSP setting. I have a WORKING .PSP page with the following in it:

<form method="get" action="ph-cgi/playmacro">
     <input type="hidden" name="id" value="WINAMP PLAY">
     <input type="hidden" name="nexturl" value="/ph_macros.htm">
     <input type="submit" value="Winamp Play" name="B12"></p>
</form>

My question is how does one get "dynamic data" from PH to display in the webpage? For example, suppose I want to show the status of WinAmp in the PSP page. The following DOES NOT work. What should it be?

<form>
<form method="post" action="/ph-cgi/evalformula" name='"PH_winampinfo("status",0)"'>
</form>




__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: July 13 2006 at 07:23 | IP Logged Quote TonyNo

Displaying data is easier. For your example you would use...

<% PH_winampinfo("status",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: July 14 2006 at 21:37 | IP Logged Quote dhoward

Smarty,

Keep in mind also that your static HTML above does not have to be a PSP page but will also work fine in a standard HTML page. You only need PSP if you want dynamic pages where PowerHome forumlas are evaluated.

Essentially, all a PSP page is a standard HTML page with embedded PowerHome formulas within <% %> tags. When PowerHome serves a page with an extension of PSP, it searches the text for the <% %> tags and evaluates the forumla between them. The result of the formula then replaces the formula and tags and then the next formula is evaluated. This continues until all formulas are evaluated and then the resulting text is served as an HTML page.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: July 14 2006 at 22:00 | IP Logged Quote smarty

Dave & Tony,
Thanks very much for answering my "newbie" questions. I have actually be able to do quite alot with what you guys have shown me so far.




Edited by smarty - July 14 2006 at 22:01


__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 

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