Antville Macros |
... Previous page
Monday, 2. September 2002
<% story.topic %>
robert
21:57h
This macro can be used to display the topic a story belongs to: either as text, link or image. As a minimum you need the following: <% story.topic %> This will display the name of the topic as link to the main page of the topic. <% story.topic as="text" %> will display the name of the topic just as plain text. Now using the attribute as="image" is a bit more complex: <% story.topic as="image" %> What will happen now? Assuming you have a story that belongs to the topic "topicmaps", Antville will search in the imagepool of your weblog for an image with the name "topic_topicmaps". The prefix "topic_" is added by default, but you can customize this too: <% story.topic as="image" imgprefix="icon_" %> Antville will then search for an image named "icon_topicmaps". If it finds one it will display it as link to the main page of the topic. ... Link (3 comments) ... Comment
<% story.commentlink %>
robert
21:44h
This macro renders by default a link to the form for adding a new comment. <% story.commentlink %> Now this might appear a bit useless since you could also use the link-macro to do the same: <% story.link to="comment" %> The main reason for this special macro is that it checks if comments are enabled for a story or not: if comments are disabled it won't display anything. There are two attributes for customizing the result: <% story.commentlink to="comment" text="place your comment!" %> to means the page this macro should link to, and text defines what should appear as link. The above example shows the defaults (so you can omit them if that's what you want). ... Link (1 comment) ... Comment
url
robert
21:37h
Another macro that can be used for quite a lot of items: <% story.url %> The result of these macros is - surprise! - the url to the story, comment, site, image or file. Additionally, you can use the "action" parameter to append a specific action name after the url: <% site.url action="referrers" %> ... Link (3 comments) ... Comment
creator and modifier
robert
21:20h
The creator-macro can be used for nearly every asset in Antville: stories, comments, images, files, polls and shortcuts. The usage is always the same (the following example shows the usage for stories): <% story.creator %> will display the name of the creator of a story. If you want the name appear as link to the personal URL the user has specified in the profile use the following: <% story.creator as="link" %> Now try this: ... Link (0 comments) ... Comment
<% story.content %>
robert
20:54h
This macro is also available as <% comment.content %>. Now this is probably one of the most interesting (and flexible) macros of Antville. Using this macro you can not only display story- or comment-content but also customize the basic structure of stories and comments in your weblog! But let's start with the basics (the following examples show you the usage for both stories and comments): <% story.content part="title" %> will display the title of a story - if it has one. Normally nothing would be displayed, but if you use the fallback-attribute you can tell Antville what content-part it should use if no title is available: <% story.content part="title" fallback="text" %> This would display the text of the story or comment if it doesn't have a title. If you want to display just the first part of the text you can also do that: <% story.content part="title" fallback="text" limit="20" %> will use the text of the story, but display it only 'til the first whitespace after the 20th character (neat, innit? ;-) Additionally the desired part can also link to the main page of the story (this only works with stories as comments do not have a main page!), eg. <% story.content part="title" fallback="text" limit="20" as="link" %> will render the title (or the text limited to around 20 characters) as a link to the main page of the story. Customizing the structure of stories and comments Let's assume you need stories that not only consist of a title and a text, but you also need a lead-text that should be displayed in all storylists (eg. the frontpage of your weblog, the frontpage of a single day and the main page of a topic). All you have to do is to modify the skin for editing/creating a new story (you can find it in the "advanced" skins of the skinmanager). Simply add the following to the skin: <% story.content part="lead" as="editor" cols="30" rows="5" wrap="virtual" %> Now what will happen? Antville will display a new textarea in the form, and in the moment you save the first story with a lead-text it will be stored. To display it simply edit eg. the story-"preview" skin and use the content-macro again, this time slightly different: <% story.content part="lead" fallback="text" %> This will display the lead-text of a story if available, otherwise display the whole text of it. Got the idea? But we're not finished 'til now: <% story.content part="image" as="editor" %> will do something else: the first macro - if embedded in the skin for creating/editing a story - will render a simple text-inputfield where you could type in the name of an image out of the imagepool. The second macro will read the name of the image, look in the imagepool if there is an image with this name and - if found - display it as a link to the main page of the story. ... Link (9 comments) ... Comment ... Next page
|
Online for 8328 days
Last modified: 2/20/20, 5:31 AM Status
Youre not logged in ... Login
Menu
Search
Calendar
Recent updates
Grundlegendes: Wie Macros entstehen Im
Zuge der Erneuerung der hier befindlichen Dokumentation soll dargestellt werden,...
by libralop (1/18/17, 2:21 PM)
If the link on the
starting page leads you to http://foo.blogger.de/topics/topic1/ and you want...
by kinomu (1/6/11, 3:43 AM)
how to make topicchooser redundant?
hello, i am new to antville and have a problem...
by cafereiche (1/5/11, 8:26 PM)
+ position and line distance
" itemsuffix="" %> how does ist function? every time when...
by miamicat (7/12/10, 5:23 PM)
with a little javascript like:
<div><% story.content part="lead" fallback="text" %> <script type="text/javascript"><!-- var lead =...
by dotnet (4/9/09, 3:00 PM)
There's another parameter which enables
to specify the blog whose imagelist you would like...
by giardino (1/4/09, 11:00 AM)
Thanks a lot for the
quick response, kinomu. The good side: Now I have...
by molosovsky (1/16/08, 11:59 AM)
There is no technical solution
to this problem, but try to change (or insert)...
by kinomu (1/16/08, 10:22 AM)
Sorry if I’m too stupid
to wrap my brain around this problem: Is there...
by molosovsky (1/16/08, 9:48 AM)
Optional viewlink I am using
the lead for long stories. And wish to give the...
by byggvirofbarley (7/12/07, 10:49 PM)
Macros to use smileys in
comments? Hi! I added some smileys to my image gallery...
by stuepfnick (5/20/07, 2:30 PM)
Ähm, ich glaube das Fixen
muss nicht mehr sein Hallo, äh 2004 der letzte Inhalt....
by stsboard (3/9/07, 9:48 PM)
I found a solution
and modified it slightly for usage with Antville. Add to...
by ichichich (1/18/07, 1:07 PM)
story.age would be great to
have a macro that does the same for stories. I'd...
by imp13 (1/17/07, 10:40 PM)
is it somehow possible to
change the word "comments" itsself, that automatically results when...
by yetused (11/11/06, 9:55 AM)
That is possible: http://macros.antville.org/stories/44385/
(Beware: An invalid format of the timestamp may corrupt the database...
by ichichich (11/10/06, 10:38 AM)
Edit date OK, thanks for
the feedback. This was just the answer I had already...
by mwegsche (11/10/06, 8:47 AM)
limit stories I want to
limit the number of stories on the homepage of my...
by mwegsche (11/9/06, 4:58 PM)
To get the login form/skin
you must add to query: skins/edit?key=MemberMgr.login
by click (7/29/06, 1:33 AM)
Need Help! I need to
modify the "Login" form/skin that a visitor to my blog...
by aqss (6/18/06, 10:15 PM)
that more interesting part of
the question didn't get answered ;) how can we...
by schimmerschnecke (1/31/06, 1:02 AM)
|