Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Set Javascript Variable to Page NameSet Javascript Variable to Page Name
Previous
 
Next
New Post
6/8/2007 1:20 AM
 

I have the need to include some custom javascript in each page on my site. (See the snippet below) I am trying to figure out how to set the s_PageName variable to the name of the current page. I know that PortalSettings.ActiveTab.Title will return this but I am not quite sure how to implement.  Anyone have any ideas?

<script language="JavaScript">
var s_PageName="Page Title";
</script>
<script language="JavaScript" src="my_javascript_include.js"></script>

Thanks in advance.

Tom

 
New Post
6/8/2007 6:32 AM
 

have a look at the client api documentation (http://www.dotnetnuke.com/LinkClick.aspx?fileticket=pUrl3n6Gs8E%3D&tabid=478&mid=857). It has a section about passing data between server and client

Public Shared Sub RegisterClientVariable(ByVal objPage As Page, ByVal strVar As String, ByVal strValue As String, ByVal blnOverwrite As Boolean)

objPage          Page object being rendered
strVar              Variable name to set
strValue          Value to set
blnOverwrite   Flag determines if variable is appended or overwritten


Erik van Ballegoij, Former DNN Corp. Employee and DNN Expert

DNN Blog | Twitter: @erikvb | LinkedIn: Erik van Ballegoij on LinkedIn

 
New Post
6/9/2007 3:02 AM
 

Thanks for the reply.

I took a look at the Clinet API doc but and now more confused than before. Do I put this in my template? Can't I just use a token  to retrieve the page title similar to the <%=skinpath%> token like this?

<script language="JavaScript">

var s_PageName= "<%=PageTitle%>"

</script>

Tom

 

 
New Post
6/9/2007 4:44 PM
 

You can find out how to get the Page Title and more into your skin at the following link:

Some tricks for getting TabNames in your DNN Skins


DotNetNuke Modules from Snapsis.com
 
New Post
6/11/2007 1:16 PM
 

To register a variable for use on the client you call the RegisterClientVariable method from some piece of code.  Specifically you could place this line in your skin. 

<% DotNetNuke.UI.Utilities.ClientAPI.RegisterClientVariable(Me.Page, "pagetitle", PortalSettings.ActiveTab.TabName, True) %>

Then in your custom js, you will access the pagetitle variable with this line

dnn.getVar('pagetitle');


 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Set Javascript Variable to Page NameSet Javascript Variable to Page Name


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out