|
Home > Archive > Microsoft Content Management Server > March 2006 > How to get the second level channel name?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to get the second level channel name?
|
|
|
| Hi
I've created a generic template for all pages in the site. Also, i created a
few stylesheets, stylesheet is applied to a page according to the which
channel that the user currently is in. This channel is the second level
channel. See my channel structure below:
Channels
mysite
ChannelA
ChannelA.1
ChannelA.1.1
ChannelA.1.1.1
more sub channels
Channel B
Channel B.1
...more sub channels
If user in channel A, then I apply stylesshet 1, if user in channel B, then
I apply stylesheet 2. All I need to do is to identitify the second level
channel.
I created a funtion to read the url path and use split function to capture
the second level channel name. For example:
http://myservername/mysite/ChannelA/ChannelA.1, my function returns ChannelA,
This is only working in the Published mode (live mode), if i am in the
authoring mode, then the url listed the
http://myservername//NR/exeres/#####.....
and many lenghthy ids
Is there an easier way to solve this problem?
| |
|
| You can get the current channel or posting and recurssively check for it
parent. The number of parents will be its level in the tree.
"Mindy" wrote:
> Hi
>
> I've created a generic template for all pages in the site. Also, i created a
> few stylesheets, stylesheet is applied to a page according to the which
> channel that the user currently is in. This channel is the second level
> channel. See my channel structure below:
>
> Channels
> mysite
> ChannelA
> ChannelA.1
> ChannelA.1.1
> ChannelA.1.1.1
> more sub channels
>
> Channel B
> Channel B.1
> ...more sub channels
>
> If user in channel A, then I apply stylesshet 1, if user in channel B, then
> I apply stylesheet 2. All I need to do is to identitify the second level
> channel.
>
> I created a funtion to read the url path and use split function to capture
> the second level channel name. For example:
> http://myservername/mysite/ChannelA/ChannelA.1, my function returns ChannelA,
>
> This is only working in the Published mode (live mode), if i am in the
> authoring mode, then the url listed the
> http://myservername//NR/exeres/#####.....
> and many lenghthy ids
>
> Is there an easier way to solve this problem?
>
| |
|
| Thanks!
I got it working now.
"Eric" wrote:
[vbcol=seagreen]
> You can get the current channel or posting and recurssively check for it
> parent. The number of parents will be its level in the tree.
>
> "Mindy" wrote:
>
| |
| ahmed.salam@gmail.com 2006-03-06, 2:47 am |
| Hi Mindy,
Use the CMS Context object to get the current posting object and
then you can
get the parent channel of the posting.
Regards,
Ahmed
Mindy wrote:
> Hi
>
> I've created a generic template for all pages in the site. Also, i created a
> few stylesheets, stylesheet is applied to a page according to the which
> channel that the user currently is in. This channel is the second level
> channel. See my channel structure below:
>
> Channels
> mysite
> ChannelA
> ChannelA.1
> ChannelA.1.1
> ChannelA.1.1.1
> more sub channels
>
> Channel B
> Channel B.1
> ...more sub channels
>
> If user in channel A, then I apply stylesshet 1, if user in channel B, then
> I apply stylesheet 2. All I need to do is to identitify the second level
> channel.
>
> I created a funtion to read the url path and use split function to capture
> the second level channel name. For example:
> http://myservername/mysite/ChannelA/ChannelA.1, my function returns ChannelA,
>
> This is only working in the Published mode (live mode), if i am in the
> authoring mode, then the url listed the
> http://myservername//NR/exeres/#####.....
> and many lenghthy ids
>
> Is there an easier way to solve this problem?
|
|
|
|
|