tags:

views:

20

answers:

1

I have a multi language site with the following structure:

siteroot - en -- home -- login -- etc. - de -- home -- login -- etc.

The content beneath the language nodes is not necessarily the same. When switching languages I want to test if the a paralell language node exisist.

Currently I'm doing the following: - get current path - replace the language part of path e.g. replace /en/login to /de/login - the closest i've found to test the existance of a page is: XPathNodeIterator i = umbraco.library.GetXmlDocumentByUrl("http://localhost/de/login");

Debugging this shows, that umbraco actually hits the database. This can't be the best way to test the existance of a page.

Anybody have a better method at hand?

A: 

By the sounds your using the document class in cms.businesslogic.web namespace. This class is used for modifying/publishing nodes inside of umbraco.

Try using the node class that resides in umbraco.presentation.nodeFactory. This will interact with the in-memory XML cache only.

Node.GetCurrent() //static method - will give you the current loaded page.
Node.Parent //class property - will give parent method

The problem with the node class, that it can't take XPath queries (and will not give performance)

I've written a dynamic Linq provider that can be used to query the Umbraco XML structure using compiled xslt expressions. I going to be publishing in the next week or so. Let me know if your interested...

Elijah Glover
i used the business logic, exactly because it doesn't take xpath queries. your link provider sounds very interesting!
AyKarsi