Now for those who wants to know why I thought of this way, then it is because I have a repo of pages which are publicly restricted and I need to show part of this information on another page, so only part of the information is actually 100% restricted. Then I want to access the page showing the page elements which are ok and then set the page title for the site as per the standards.
So having a title property on the page and want to use that title property to set the page title from an xslt extension or similar from the xslt file - or if you have any other great idea I am all ears.
Maybe i am missing something about your specific senarion, but wouldnt it be easier to just wire up your XSLT to a macro and put that in your masterpage?
Well I would still not be able to get the title tag from the other page
As I said I have the following structure
- Content - Frontpage - Subpage (I want to display the product pages title and not the subpages title when on this page with a querystring param - so I have put in a macro that gets the contents of the pages under the product node, now to show the contents of the product page I access the current page with a querystring param so /subpage.aspx?pid=2343) - Product - Product 1 (2342) - Product 2 (2343)
ok I would create a property on the Subpage of type content picker, which will allow you to pick the Product 1 page.
then in your XSLT you should be able to get the node id, and do a getXmlByNodeId .... then you have all the contents of the Product 1 page, while you are on the SubPage
lets say that I have my subpage and want to get any of the products in my Product folder by querystring then how would I set the page title?
cause the way umbraco fields work right now is that it takes the current page title (which will always be subpage.aspx - no matter which template I use or querystring parameters are set).
which is why if I in my xslt file could create an extension method to set the page title at runtime then I would be happy :)
well if you want to get them from the querystring, there are XSLT extension methods
umbraco.library:Request('String key')
umbraco.library:RequestQueryString('String key')
umbraco.library:RequestForm('String key')
You should be able to build in the logic you need in the XSLT file .... if you cant do everything then you can always build your own XSLT extension to return the correct text, but i would recommend you wire the XSLT (via a macro) directly into the master page
Not really sure how to go about doing it the way you are trying to ... another idea i had was to maybe wire the macro to a .net user control. the user control should be able to find the parent master page and change the title tag ... just a thought ... running out of ideas :)
@Scott have you been able to get it working? I have a queryString as well that am parsing to a page but someone cant get the page to display the value.
Create an xslt extension method to set page title?
Hi all,
I have built a usercontrol to set the title of the page from an xslt file but the file fails to render.
I have the following which builds fine but does not work:
uuc.dll
SetPageTitle.xslt
Now for those who wants to know why I thought of this way, then it is because I have a repo of pages which are publicly restricted and I need to show part of this information on another page, so only part of the information is actually 100% restricted. Then I want to access the page showing the page elements which are ok and then set the page title for the site as per the standards.
So having a title property on the page and want to use that title property to set the page title from an xslt extension or similar from the xslt file - or if you have any other great idea I am all ears.
Thanks!
Scott
if you have page title as propety in document type. you can use this value in template .
open template simply add <title><umbraco:Item field="pageTitle" runat="server"></umbraco:Item> between <head></head> tags.
here the pageTitle is the name of - generic property in document type .
so you can edit page title any time . if you need to keep page heading different to page title keep two properties. or use one property for both
Hi pat,
Yes I have that as well but as I get the page dynamically (at runtime) then the pageTitle is not changed. My structure is like this:
Maybe i am missing something about your specific senarion, but wouldnt it be easier to just wire up your XSLT to a macro and put that in your masterpage?
Well I would still not be able to get the title tag from the other page
As I said I have the following structure
- Content
- Frontpage
- Subpage (I want to display the product pages title and not the subpages title when on this page with a querystring param - so I have put in a macro that gets the contents of the pages under the product node, now to show the contents of the product page I access the current page with a querystring param so /subpage.aspx?pid=2343)
- Product
- Product 1 (2342)
- Product 2 (2343)
It should be possible but I am a bit stuck.
ok I would create a property on the Subpage of type content picker, which will allow you to pick the Product 1 page.
then in your XSLT you should be able to get the node id, and do a getXmlByNodeId .... then you have all the contents of the Product 1 page, while you are on the SubPage
lets say that I have my subpage and want to get any of the products in my Product folder by querystring then how would I set the page title?
cause the way umbraco fields work right now is that it takes the current page title (which will always be subpage.aspx - no matter which template I use or querystring parameters are set).
which is why if I in my xslt file could create an extension method to set the page title at runtime then I would be happy :)
@asif - Thanks for inputting
well if you want to get them from the querystring, there are XSLT extension methods
umbraco.library:Request('String key')
umbraco.library:RequestQueryString('String key')
umbraco.library:RequestForm('String key')
You should be able to build in the logic you need in the XSLT file .... if you cant do everything then you can always build your own XSLT extension to return the correct text, but i would recommend you wire the XSLT (via a macro) directly into the master page
I get the thing with the request methods, which are quite straight forward.
but what I do not get is how to set the page title.
I don't want to test per url to set page title I want it to be a function where I can just parse text to it like
<xsl:value-of select="iPage.SetPageTitle('my new page title')" />
And finish
Not really sure how to go about doing it the way you are trying to ... another idea i had was to maybe wire the macro to a .net user control. the user control should be able to find the parent master page and change the title tag ... just a thought ... running out of ideas :)
@Scott have you been able to get it working? I have a queryString as well that am parsing to a page but someone cant get the page to display the value.
is working on a reply...