Dec 04, 2008, 12:38 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Read what MODx Developers say: MODx Dev. Blogs
Pages: [1]   Go Down
  Print  
Author Topic: Adding a template variable to ditto  (Read 1188 times)
0 Members and 1 Guest are viewing this topic.
simonok
Full Member
***
Posts: 148



WWW
« on: Jul 30, 2006, 05:23 AM »

I want ditto to pull out the template variable's not the main body content.

What is the syntax to enter a template variable using ditto

I have

[!ditto? &startID=`44` [+tvAffiliate_Description+] !]

Its not doing anything is the syntax correct? my variable is called Affiliate_Description do I need to append tv on it?

ss
Logged

I made my first site with modx
------------------------
Shopping blog
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #1 on: Jul 30, 2006, 05:54 AM »

Ditto will automatically pull any TV in a Ditto tpl so long as it is prefixed by tv.

For instructions on how to create a Ditto tpl see the Ditto documentation on the main support site,
Logged

simonok
Full Member
***
Posts: 148



WWW
« Reply #2 on: Jul 30, 2006, 06:46 AM »

Got it, I feel a bit of a muppet quite easy to get it to work, its just that the example is a bit weak for a web designer to get your head around, I didnt know you had to create a chunk, so for others try this (feel free to correct me)

1. Install the ditto snippet
2. Create your template variables in manage resources/template variables/
3. Create a category folder and create some sub pages under it (you should see your template variables when adding pages)
4. Create a chunk (manage resources/chunk) call it dittotemplate or some other name
5. template variables must contain a prefix of tv so if you named it Affiliate_description it must be [+tvAffiliate_Description+], for the chunk enter something like this;

<div class="ditto_summaryPost">
<h3><a href="[~[+id+]~]">[+title+]</a></h3>
<div>[+summary+]</div>
[+tvAffiliate_Description+] <br>
<p>[+link+]</p>
<div style="text-align:right;">by <strong>[+author+]</strong> on [+date+]</div>
</div>

6. save the chunk and edit your main category page
7. Under document content click the source button and enter this [!ditto? &tpl=`DittoTemplate` &startID=`44`!]
8. That line calls the dittotemplate chunk you just created starting. The startID is the main category id number.
9. It should now show all the pages with a summary or whatever you wanted it to show in the chunk.

Logged

I made my first site with modx
------------------------
Shopping blog
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #3 on: Jul 30, 2006, 10:07 AM »

Exactly, nicely said.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!