NetTalk Central

Author Topic: Using session variable to insert xhtml  (Read 4811 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Using session variable to insert xhtml
« on: March 04, 2015, 09:41:18 AM »
Bruce,

     I have a home page (NetWebPage) that simply displays some info about the current user.  Thus there is a lot of white space.  I thought I would build a messaging system to allow me to display messages.  So I created a routine to create a session variable called StudyMessage.  The test code is as follows:

p_web.SSV('StudyMessage', '<span style="color: #ff00ff; font-size: 12pt;">message </span>in <span style="color: #ff0000;">red</span>')
  
I then added a <!-- Net:s:StudyMessage --> tag to the XHTML tab, as seen in the attached image xhtml.png.

The end result shows the literal text of the HTML, see image homepage.png.  Can you point me to where I went wrong?

I should add, that I want to pull blocks of xhtml from a database and populate the session variable.

Thanks,

Jeff


[attachment deleted by admin]
« Last Edit: March 04, 2015, 10:08:19 AM by kingja »

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Using session variable to insert xhtml
« Reply #1 on: March 04, 2015, 11:01:57 AM »
The HTML in the session variable gets converted to the code seen in line 234 of the attached image.  Still searching for a cause/solution.

Jeff

[attachment deleted by admin]

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Using session variable to insert xhtml
« Reply #2 on: March 04, 2015, 11:36:55 AM »
Hi Jeff

I think I'd do it the other way around, ie setting the styling/css in the xhtml window and then just have the message var contain - well, the message. And of course you could have several message variables with different styling, eg one for a header and one for the message itself.

JAT
Peter

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Using session variable to insert xhtml
« Reply #3 on: March 04, 2015, 11:49:44 AM »
Peter,

     Thanks for the input.  I'm not sure that will give me the results I'm looking for.  Basically I want three sections for messages.  One on the left, one in the middle and one on the right.  The current message with the user login info is on the left.  Now I want to put other data in the center and right sections.  For example, I want study notices in the center and then maybe some sort of dashboard in the right section.  Thus each section requires different formatting, etc.  With the CSS tab on the templates there does not seem to be the granular control I think I need.  See the attached image.  Maybe I have missed your point.  Feel free to expand on this!

Thanks,

Jeff

[attachment deleted by admin]

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Using session variable to insert xhtml
« Reply #4 on: March 04, 2015, 12:07:35 PM »
Jeff,
I was not refering to the CSS tab in the template but rather the xHTML tab.

On the image in your original post I see you've got a div around your message. In that div you also have class=blabla. So my suggestion is to put all the formatting and styling into a css class and name that in the div tag. This way you get cleaner code and everything will be where it belongs (styling in css, text in session variable). And you can have all the div's you want, all with the same or different styling.

Peter

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Using session variable to insert xhtml
« Reply #5 on: March 04, 2015, 01:05:15 PM »
Peter,

     I think I understand.  So, here is my xHTML tab (xHTMLTab.png) and my custom CSS is (custumCSS.png).  It results in the image seen in results.png.  I actually had it working once.  Then I went back to the custom.css file and adjusted the widths.  Now it does not seem to apply the CSS.  What do you think?

Jeff

[attachment deleted by admin]

JPMacDonald

  • Full Member
  • ***
  • Posts: 106
    • View Profile
    • Email
Re: Using session variable to insert xhtml
« Reply #6 on: March 04, 2015, 05:21:00 PM »
Hi,

Have you tried using  Net:x:StudyMessage instead of  Net:s:StudyMessage

Regards

Parker

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Using session variable to insert xhtml
« Reply #7 on: March 04, 2015, 06:00:43 PM »
Parker,

     Thanks, I did not know that existed.  But alas, no luck.  I'll keep experimenting.

Jeff

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Using session variable to insert xhtml
« Reply #8 on: March 04, 2015, 06:18:14 PM »
Success!  I went back to Net:s:StudyMessage and removed the leading dot from my css, which is now:

section{
 width: 60%;
 height: 50px;
 background: aqua;
 margin: auto;
 padding: 10px
}
div#one{
 width: 15%;
 height: 50px;
 background: red;
 float: left
}
div#two{
 margin-left: 20%;
 height: 50px;
 background: yellow
}

I'll be experimenting more with css to alter the position and colors, but this is a good start!  See attached image.

Jeff

[attachment deleted by admin]

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Using session variable to insert xhtml
« Reply #9 on: March 04, 2015, 06:42:52 PM »
The only problem with this technique is I still can't seem to have HTML within the session variable.  I may want to add tables, images, fonts, bold etc., within each of the sections created here.  

For example, I want to call a form that has the redactor/tinymce editor on it.  The user would create any HTML document they need and save it to a file.  Then they would select the section in which to place this newly created HTML text.
Any thoughts?

Jeff
« Last Edit: March 04, 2015, 06:48:44 PM by kingja »

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Using session variable to insert xhtml
« Reply #10 on: March 05, 2015, 01:28:43 AM »
Hi Jeff,

Glad to see you're making progress!

You might want to use Net:f:filename to serve the file directly. That'll take whatever is in the file including html and even inline css (which of course you should not be using <g>).

Peter

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Using session variable to insert xhtml
« Reply #11 on: March 05, 2015, 07:20:36 AM »
Peter,

     Any examples on how to use this?  I'm looking at the sample NetTalk apps to see if there is something there.

Jeff

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Using session variable to insert xhtml
« Reply #12 on: March 05, 2015, 07:43:10 AM »
Just replace 'filename' with the name of your actual file eg <!-- Net:f:yourfile.htm -->
The file must reside in or under the web folder.

Peter

Updated: Jeff, now you got me started on this  ;) You could actually take a somewhat different approach and embed one or more webbrowses on your page. The browse(s) would contain only one field per row = the users text. And you can remove all the standard browse characteristics so it'll look just like any other list.
« Last Edit: March 05, 2015, 10:47:32 AM by peterH »

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Using session variable to insert xhtml
« Reply #13 on: March 05, 2015, 11:17:32 AM »
Peter,

Yup, so many ways to do this now that we have started.  So, here is a fine example using your first idea.  Looking pretty good!

Thanks,

Jeff

[attachment deleted by admin]

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Using session variable to insert xhtml
« Reply #14 on: March 05, 2015, 12:51:27 PM »
Nice!