We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    Hi guys my pages show ditto results great cos i’ve put a small photo thumbnail in top of pages so that shows up with a line of text.

    however my weblinks just come up as name of page and where the link is going which doesn’t look as good. is there a way to add a bit of code into the weblinks or ditto to make these look like other results. for an example see this page: http://www.insideyork.co.uk/americanfood.html

    pizza hut comes up very plainly however i don’ t want another seperate page for this as it is also in another section/category so i just want to link to that page but make it have thumbnail etc...

    hmm any suggestions would be appreciated... thanks.
      • 7231
      • 4,205 Posts
      Yes. you can add the image as a TV rather than using it in the document content. Then in the weblink document you could set an image. If you dont want to backtrack and change the way you have the other entries you could use PHx to identify that it is a weblink (reference) and display the image rather than the content field.

      This post has some ideas for dealing with weblinks:
      http://modxcms.com/forums/index.php/topic,20413.0/topicseen.html
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 34162
        • 1 Posts
        hi thanks for the reply, that sounds promising but is a little hard for me to understand how to apply it to my pages, it would be great if i can have something in the weblink to tell ditto to preview where it’s pointing and not the link itself, is this what you mean?
          • 7231
          • 4,205 Posts
          Yes. Based on the example from the link above you could do something like this (this is using PHx syntax which is available within ditto chunks):
          [+type:is=`reference`:then=`[+description+]`:else=`[+content+]`+]
          This is basically saying to load the description field (document variable) if the document is a weblink (which is identified by type reference) otherwise load the content field.

          You could adapt this as needed. In this example I would add the image reference to the description field (manually) and instructed ditto to display that for weblinks. You could also use any variable (template or document), you could even use a richtext template variable to simulate the standard content editor.

          BTW - you would place the code above in your Ditto template chunk in the place that you reference the document content.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]