Using OpenWebStudio to assign a PageTitle is simple. The following demonstration will show you how to change the Page Title in two ways - the first and most straight forward by utilizing the Assignment Action and the second, a more advanced scenario which assigns the page title during an AJAX operation.
To get started, lets assume you have already installed Open Web Studio on your target platform.
- For the first scenario, add an Assignment Action to your configuration.
- Set the Variable Type of the Action to "PageTitle"
- Set the Value of the Action to the preferred value. You can use tokens here if there are any you need.
- Save the action and publish the configuration.
It is important to note that the Page Title can ONLY be assigned via a NON AJAX request. During AJAX operations, the Page Title would need to be manually changed via a Script execution. To provide a more advanced scenario for establishing the page title by reading from the querystring via an AJAX operation, use the following scenario.
The next configuration can now be created to show a list of Tabs contained within the database, and using ows.Fetch - the Querystring will contain a TabID, which will be named "tid". Whenever the "tid" value changes, the Title of the page should also change.
Typically I would not execute queries against the tabs table, but its a table I know will exist in your data structure, and is therefore safe to demonstrate.
- Add a Region, and set it to Page Load Only.
- Add a Query Template and set the query to "Select top 20 * from Tabs"
- Next, open the detail template and assign it to <div onclick="ows.Fetch('[ModuleID,System]',-1,'tid=[TabID]');','dvHidden');">[TabPath]</div>. Again, note the parameters. The first identifies the Module which is to be affected, the second, the page numbering. In this case we are not going to have our request affect the current page number so we set it to -1. The third parameter identifies the Querystring which will be dictated to the server, this appends to any querystring which is already assigned at the page level. And finally, as noted previously - dvHidden is the target of our request.
- Now we add a Region which specifically handles the AJAX request.
- Add a Query Variable which will consume the tid from the querystring which is passed via OWS.Fetch. Name the variable @tid, and set it to only allow numeric values.
- Add a Template action, and set the Query Template to consume the @tid variable we just created, "Select * from Tabs where TabID=@tid
document.title = 'You selected [TabName]';
- Now you can see the result!