Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Dynamic Template Page View modes: 
User avatar
Member
Member
leem - 7/22/2009 5:23:56 AM
   
Dynamic Template Page
i have a template page used/shared for sub sections of my site. The template page has several web parts each displaying data relevant to the section it is in, how can I get the pass the section I am in to their webparts so they can filter the data?

--Root
----Sections
------SubSection1
----------Item1InSubSection1
----------Item2InSubSection1
------SubSection2
----------Item1InSubSection2
------SubSection3

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 7/22/2009 6:34:02 AM
   
RE:Dynamic Template Page
Hi,

It depends on what exactly you want to set for the web parts according to the section. From your description I am not clear about it. But in the web part settings you can use the path expressions to set the current path and also for other settings you can use macro expressions basedon current document properties.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
leem - 7/22/2009 7:26:25 AM
   
RE:Dynamic Template Page
Hi,

I am using a repeater with custom query web part within my page I want to display child documents of the current page and of a set document type. I have the type filtering working but can't seem to filter on child documents of the current page as I am using a custom query I added the ##WHERE## and set a path expression on the web part property WHERE as {&./%&}.

What am I missing?

Lee

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 7/22/2009 8:18:04 AM
   
RE:Dynamic Template Page
Hi again,

In the WHERE condition property field, could you please try to use just: ./%?

Best Regards,
Juraj Ondrus

User avatar
Member
Member
leem - 7/22/2009 8:29:59 AM
   
RE:Dynamic Template Page
I tried that also but same result kicks me into safe mode

User avatar
Member
Member
leem - 7/22/2009 8:36:56 AM
   
RE:Dynamic Template Page
this is my sql

SELECT TOP 10 ##COLUMNS## FROM custom_item WHERE ##WHERE##

User avatar
Member
Member
leem - 7/22/2009 8:39:23 AM
   
RE:Dynamic Template Page
in the event log this is the error I get

Message: [DataConnection.ExecuteQuery]: Query: SELECT TOP 10 * FROM custom_item WHERE ./%: caused exception: Incorrect syntax near '/'.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 7/23/2009 3:11:12 AM
   
RE:Dynamic Template Page
Hi,

I am sorry for the confusion - it was my fault. I do not know what I was thinking about, maybe it is due to the hot weather here :-).

In the WHERE condition property needs to be some field from the DB you want to have condition with it. For example: WHERE NodeAliasPath LIKE '/%'.

So, in your case you need use a macro in the where condition field as well. It could be like this:

NodeAliasPath LIKE '{%cmscontext.currentdocument.nodealiaspath%}/%'

I hope it will help and I am sorry for the confusion once again.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
leem - 7/27/2009 3:31:32 AM
   
RE:Dynamic Template Page
Hi,

I think its better hot than the rain I have here.

I tried your method with the NodeAliasPath but as working with a custom document type it throws an Invalid column name 'NodeAliasPath exception, I'm guessing I need to join with another table, can you advise any further?


User avatar
Kentico Developer
Kentico Developer
kentico_martind - 8/3/2009 2:12:51 PM
   
RE:Dynamic Template Page
Hi Lee,

Yes, you need to join with CMS_Tree table. But if you use version 3.1a or later I would recommend making selection from view appropriate for your document type instead (as it contains all tables and fields necessary for document and is used by standard controls like CMSRepeater etc.). You can find its name in 'Views' section of DB used by Kentico CMS. E.g. view for CMS.News document type is called View_CONTENT_news_Joined.

Best Regards,

Martin Dobsicek