Have tried so many of the solutions I found by searching the forum, but no luck yet.
I have created a document-type that has a generic property called start-date and I want to make a macro for the document using that document-type that accesses start-date and more when it is finished.
My problem is that I can't find the right way to get that generic property value into my macro. Most tries have been with currentPage.
Try this simple macro - it will only do something if the currentpage is your specific Document Type and it has a value in the property - and then only if the date in that property is before "today"...
- YES, I know it's confusing, but you should really take your time to understand how these two otherwise identical pieces of code relate, and you'll be *so* much better at reading all the code samples people paste here & there...
You are right on all counts. Being php, java etc for what feels as a lifetime, this will take som getting use to, and especially the part with understading basics from your example.
I learned from this that alot changed with 4.5, and as I am on 4.01 with the system I am servicing, I need to watch out when I look for solutions. Also I see that things have been so simplyfied which I will miss out on until they update my system ;)
Again I owe you a huge beer, time and place please :D
Use of Generic properties in macro
Have tried so many of the solutions I found by searching the forum, but no luck yet.
I have created a document-type that has a generic property called start-date and I want to make a macro for the document using that document-type that accesses start-date and more when it is finished.
My problem is that I can't find the right way to get that generic property value into my macro. Most tries have been with currentPage.
Hi Nicolai,
Try this simple macro - it will only do something if the currentpage is your specific Document Type and it has a value in the property - and then only if the date in that property is before "today"...
/Chriztian
Will try that as soon as I get home again.
Will need to buy you a beer soon Chriztian, you've saved me quite a few times up till now :D
Haha :-)
You're welcome,
/Chriztian
Ok, back at my desk. I have tried the code and I must be doing something wrong.
I have tested that $currentPage/@nodeTypeAlias gives cbx-date-ctrl-page and i can see that the dates are there when I print a $currentPage[self::*]
Hi Nicolai,
First off, if @nodeTypeAlias gives you something, you're using the "legacy XML schema" and then we need to address that.
Second, where you use start-date be sure not to wrap quotes around, 'cause then you're sending a string instead of the actual value.
So if you're actually using the new (since 4.5) XML schema this is the way to go:
- otherwise, if you're stuck on the old one - do this:
- YES, I know it's confusing, but you should really take your time to understand how these two otherwise identical pieces of code relate, and you'll be *so* much better at reading all the code samples people paste here & there...
/Chriztian
Hi Chriztian,
You are right on all counts. Being php, java etc for what feels as a lifetime, this will take som getting use to, and especially the part with understading basics from your example.
I learned from this that alot changed with 4.5, and as I am on 4.01 with the system I am servicing, I need to watch out when I look for solutions. Also I see that things have been so simplyfied which I will miss out on until they update my system ;)
Again I owe you a huge beer, time and place please :D
is working on a reply...