Page 1 of 1

The Full set of Comus %Variables%

Posted: Tue Jun 24, 2025 9:55 pm
by longsack
In addition to the %variables% you can find under the [Examples] link of Comus, here are some more that you can use for various purposes.

Note that a lot of these variables although they still work, became obsolete in version 2.51 with the addition of the Advanced tab in the pages area.

GLOBAL VARIABLES: These variables can be used anywhere, they will work within the templates and apply to a whole page, they often will also work inside a query or inside the thumb or link template.
LOCAL VARIABLES: These type of variables will only work inside a link or thumb template, as they have no meaning outside of the thumbs and links. %description% for example, means nothing on a template page, but refers to the description within each gallery.

------------------------------------------------------------------------------------
GLOBAL VARIABLES (for locals see below)

%templatename%
Will replace all occurances of %templatename% with the first part of the source filename for the template.

So if you named your source 'Teen.tmpl' then the following code placed on a template...

Code: Select all

<img src=%templatename%.jpg>
would translate to

Code: Select all

<img src=Teen.jpg>
This can be handy for creating dynamic templates for archives, as it can also be applied to your queries.

For example the following query will look in all categories, keywords, descriptions for the templatename and galleries that are at least 1 day old.

Code: Select all

{{setquery-age1-" periodsshown>0 and (keywords like '%%templatename%%' or description like '%%templatename%%' or category like '%%templatename%%') order by periodsshown,clicks/clickperiods DESC""}}
%updates%
This variable is an index for the number of days that the site has existed, it increments by one on each day and is the actual value that refreshdelay uses to determine when a gallery should be released by the scheduler.
This can be handy to create files for each day, with embedded code on custom templates like.

Code: Select all

<?PHP fopen($fh,"build_%updates%.html","w"); ?>
Which will create a file with the index code as the name
Another use of this variable is for accessing galleries that are scheduled, you can place code like the following into queries in the order by statements, which will hide the scheduled galleries until they are due for release, and will NEVER allow them to return as new again, thus forcing them to be 1 shot. Note also that this method can wreck havoc on the rotation algorithms, I would recommend using standard queries unless you plan to delete these scheduled galleries later.

Code: Select all

order by peridodsshown, if(refreshdelay<%updates%,1,0)
This is not the normal way to handle scheduled galleries by the way. Normally we use this technique instead, because it allows galleries to be rotated.

Code: Select all

order by periodsshown,refreshdelay DESC
%backdate% a date related to the holdperiod setting that tells us when galleries become too old.
%newbuild% A code that tells us if this page was built as new or built as part of an incremental daily build. 1=new.
%total_galleries% Tells us how many approved galleries are in the database.
%proxy% operates on macros and will place a 'p' if proxy traffic is detected. Although mo9st trade scripts today have strategies in place to manage proxy traffic, if your trade script doesnt then with a little thought of it's application, you can manage proxy traffic using this code.
%today% shows todays date.
%this_date% shows todays date, using the settings date formating.
%this_date-0% shows todays date, using the settings date formating.
%this_date-1% shows yesterdays date, using the settings date formating.
b]%this_date-2%[/b] shows date from 2 days ago, using the date formating taken from the settings page.
b]%this_date-3%[/b] shows date from 3 days ago, using the date formating taken from the settings page.
b]%this_date-4%[/b] shows date from 4 days ago, using the date formating taken from the settings page.
b]%this_date-5%[/b] shows date from 5 days ago, using the date formating taken from the settings page.
b]%this_date-6%[/b] shows date from 6 days ago, using the date formating taken from the settings page.
%this_date-7% shows date from 7 days ago, using the date formating taken from the settings page.

%this_date-8% Does not exist, it only goes up to 7.

%this_day% Shows todays day of month 01-31 with leading zeros.
%this_minute% Minutes with leading zeros.
%this_month% 01-12 month with leading zeros.
%this_MONTH% 'January -December'
%this_HOUR% 01-24, 24 hour format with leading zero.
%this_hour% 01-12,12 hour format with leading zero
%this_YEAR% This year in YYYY format.
%this_year% This year in YY format.
%TODAYS_DATE% 0-31 todays day of month NO leading zeros.


%this_weekday% 'Mon - Sun' Todays weekday.
%this_weekday-0% 'Mon - Sun' Todays weekday.
%this_weekday-1% 'Mon - Sun' weekday from 1 day ago.
%this_weekday-2% 'Mon - Sun' weekday from 2 days ago.
%this_weekday-3% 'Mon - Sun' weekday from 3 days ago.
%this_weekday-4% 'Mon - Sun' weekday from 4 days ago.
%this_weekday-5% 'Mon - Sun' weekday from 5 days ago.
%this_weekday-6% 'Mon - Sun' weekday from 6 days ago.
%this_weekday-7% 'Mon - Sun' weekday from 7 days ago.

Upper case works slightly differently...
%THIS_WEEKDAY% 'Monday - Sunday' Todays weekday.
%THIS_WEEKDAY-0% 'Monday - Sunday' Todays weekday.
%THIS_WEEKDAY-1% 'Monday - Sunday' weekday from 1 day ago.
%THIS_WEEKDAY-2% 'Monday - Sunday' weekday from 2 days ago.
%THIS_WEEKDAY-3% 'Monday - Sunday' weekday from 3 days ago.
%THIS_WEEKDAY-4% 'Monday - Sunday' weekday from 4 days ago.
%THIS_WEEKDAY-5% 'Monday - Sunday' weekday from 5 days ago.
%THIS_WEEKDAY-6% 'Monday - Sunday' weekday from 6 days ago.
%THIS_WEEKDAY-7% 'Monday - Sunday' weekday from 7 days ago.

%sitepath% gets converted into the site path and is used on various templates to create full paths to comus.

{{setvar-NAME-VALUE}}
Although not really a variable the setvar macro allows you to create your own variable which will be accessable throughout the page via %NAME% this can be handy for creating custom archive pages where you dont want to use the %templatename% variable. You can also combine this with javascript and PHP to create more dynamic listings.

Other conversions that take place.
"[BR]" gets converted to "<BR>" within links and urls.
"[square bracket]B[square bracket]" gets converted to "<B>" within links and urls.
""[square bracket]/B"[square bracket]" gets converted to "</B>" within links and urls.
"%7b%7b" and "%7d%7d" Will be replaced by {{ and }}, which might mess with some templates
"%25" will be converted to a %.

The standard globals as taken from the [Examples] pages.

%this_date% formatted date of today
%this_HOUR% 00-24 hour of today
%this_hour% 00-12 hour of today
%this_day% 01-31 day of today
%this_month% 01-12 month of today
%this_YEAR% xxxx year of today
%this_year% xx year of today
%sitename% The domain name of your site without http://
%siteowner% The name you chose for yourself in setup
%tgpemail% your registered email address
%recip% Your recip link with http:// info
%refreshperiod% The current refresh period
%this_period% The current refresh period
%totalposts% Total number of posts made
%logins% Total number of webmaster logins
%hits% Total hits on the page
%total_galleries% Total approved galleries in the system
%updates% Number of days passed since the site was new, the actual age of your site.


********************************************************
LOCAL VARIABLES (variables you can use inside the text and thumb templates and the trade script prefix settings and error urls)

%sourceurl%
When you use the gallery spider, the source url will be saved in the database. You can use this to give kudos to whoever referred the gallery. This variable will replace all %sourceurl% within the actual link or thumb template with the gallery source url collected at the time of scanning.
%sourcename%
When using the URL spider, you can assign a name to the source of the scanned gallery.

----------------------------------------------------------------------------
Displaying reports and tracking cheaters via surfer reports
Check this post http://www.comusthumbs.com/forum/viewtopic.php?t=3648

%report_images% (creates a url to 1 of 5 images determined by the warning level, see below for image names, and how you can change them)
%report_messages% (dumps one of 5 warning messages determined by the warning level, see below for messages and how to change them)
%report_main_image% (Creates a url to the default reporting icon, note: you still need to add the img tag.)
%report_info_image% (Creates a url to the icon image for more info, you still need to create theimg tag, see below for examples)
%reports% A number between 0 and 5 indicating the warning level of this gallery.
%report% Creates a complete reporting icon linked to the main report icon
%r% Creates a complete reporting link with an image icon that reflects the current reporting level. Not the same as %report%.
%i% Creates a complete info link with an info image icon.

----------------------------------------------------------------------
%url% Creates a comus link to your url, you can place this in the text and thumb templates or the trade script urls, or in settings for proxy,clickflood,fusker error, db error, etc.

---------------------
Categories, there are actually several different types of category variables.
%cat% Shows the category field of the macro, and will truncate it down removing white spaces, this is not always the actual category and will display 'all' if the macro looked like {{all-thumb-1}}.
%category% Displays the category of the gallery itself and will strip out the white space also, so if you display a Teen gallery using {{all-thumb-1}} then the script will actually display 'Teen' and not 'All'.
%rawcategory% this will display the category without stripping the white space.
%rawcat% this will display the category part of the macro without stripping the white space.
%altcat% Displays the alternate category name as defined in the categories section. Handy if you want to display something different other than the category, some people have used this to link to images instead, by placing something like Teen.jpg in the alt cat field and creating links like <img src=%altcat%>
%group% This is an alternate for category, it will default to %category% however if you define a value for the group part of the macro, then it will be fed through. IE: {{TEEN##all-thumb-1}} would send the code 'TEEN' through to the %group% variable, no matter what the actual group or category was of the gallery. This can be handy for group trading where you might want all traffic from certain pages to travel through a specific group. You can then attach the %group% variable to your trade script suffix with something like ?g=%group% and feed your trades.

%type% Will show 'thumb' for a thumb type of macro or 'link' for a text link type of macro.

%gallerytype% Will show 'Vids' for galleries that have video and 'Pics' for those that do not. This can be handy if you want to create an image for your links like 'Vids.jpg' and 'Pics.jpg' and then link to them with <img src=%gallerytype% border=0>

%domain% Will show the domain of the gallery.

%desc% Shows an abbreviated version of the description as determined by the settings where you can set the length of descriptions.
%description% Shows the full description as it appears in the database without any formatting.

%avgclicks% An alias for %ctr%. The clicks/clickperiods or the average clicks per build.
%ctr% An alias for %avgclicks%. The clicks/clickperiods or the average clicks per build.
%rating% The rating is collected for the first 24 hours of a thumb's life. It is based upon clicks*10000/exposure. Once a gallery ages beyond this, it's rating does not change.

%keywords% will display the keywords field taken from the gallery database (not the categories database)
%used% The number of times a gallery has been rotated.


Dates and Times
%TODAYS_DATE% Non formatted day of the month, with no leading 0's

Gallery Submit dates.
%dis_date% Custom formatted date of submittal
%submit_date% Custom formatted date of submittal
%submit_hour% 00-24 hour of submittal
%submit_day% 01-31 day of submittal
%submit_month% 01-12 month of submittal
%submit_MONTH% 'January-December' month of submittal (full text)
%submit_year% xxxx year of submittal
%submit_weekday% day 'Mon ... Sun' of submittal

Gallery Accepted Dates.
%accept_date% formatted date of approval
%accept_hour% 00-24 hour of approval
%accept_day% 01-31 day of approval
%accept_month% 01-12 month of approval
%accept_MONTH% 'January-December' month of acceptance
%accept_year% xxxx year of approval
%submit_weekday% day 'Mon ... Sun' of submittal

Date that Gallery was Listed on Site.
%listed% formatted date of first listing
%lstd% unformatted date of first listing
%listed_date% formatted date of first listing
%listed_day% 01-31 day of listing
%listed_month% 01-12 month of listing
%listed_MONTH% 'January-December' month of listing
%listed_hour% 00-24 hour of listing
%listed_minute% 00-59 minute of listing
%listed_year% xxxx year of listing

The standard local variables. .. taken from examples.
%onpage% The number of times the gallery has been displayed on a page, or actually used in a build, this ONLY increases when the gallery is actually used.
%clickperiods% The number of times galleries have been built since this gallery was listed as new, note that this increments regardless of whether the gallery was actually used on a page.
%periodsshown% The number of DAYs passed since the gallery was newly used on the site.
%clicks% The number of clicks on the gallery.
%ctr% The Click Through Ratio for this gallery, a score defined as clicks/clickperiods.
%cat% The condensed category taken from the database as entered in the [Category] section.
%category% The category taken from the macro - IE shows 'all' for all.
%rawcategory% The category taken from the database without condensing (no removed spaces).
%url% The target url.
%overurl% The target url, used for mouse overs (without trade script).
%domain% The domain only of the target URL
%desc% The truncated description, (max length set by you)
%description% The full description
%uid% The unique id assigned to the gallery
%id% The true id for the gallery
%nick% Submitters name
%email% Submitters email
%thumbname% The actual file name to the thumb
%thumbheight% The thumb image width
%thumbwidth% The thumb image height
%thumbsize% For compatibility, width of square thumbs
%numpic% Number of pics in the gallery (always 2 chars, ie 00...08,09,10,11)
%piccnt% A running count of the total links and thumbs displayed
%numlist% A running count of the links and thumbs in this set only
%thumbsize% For compatibility, width of square thumbs
%vote% The ranking score (1-10) assigned to the gallery
%rank% The ranking score assigned by you
%clicks% The number of times the gallery has been clicked
%dis_date% Custom formatted date of submittal
%TODAYS_DATE% Non formatted day of the month, with no leading 0's
%submit_date% Custom formatted date of submittal
%submit_hour% 00-24 hour of submittal
%submit_day% 01-31 day of submittal
%submit_month% 01-12 month of submittal
%submit_year% xxxx year of submittal
%accept_date% formatted date of approval
%accept_hour% 00-24 hour of approval
%accept_day% 01-31 day of approval
%accept_month% 01-12 month of approval
%accept_year% xxxx year of approval
%listed% formatted date of first listing
%listed_date% formatted date of first listing
%listed_hour% 00-24 hour of listing
%listed_day% 01-31 day of listing
%listed_month% 01-12 month of listing
%listed_year% xxxx year of listing

NEW addition in version 2.51
%altthumb%
This variable allows you to have a single master server where you create the thumbs, and then sub domains that are able to display the thumbs, without needing to actually export the thumbs to your other domains.

When you bulk import now, the thumb will be collected as normal however additionally the actual filename of the thumb will be recorded also in %altthumb%. NOTE that the path information is stripped and only the thumb name is recorded.

The reason for stripping the path is to allow you the flexibility to either use the original domain, or you can use the domain of your remote thumb server that you may have set up.

You need to modify your master thumb template style to have img src's like.

<img src='http://yourMasterDomain.com/ct/thumbs/%altthumb%' border=0>

or if you have a remote thumb server..
<img src='http://yourRemoteThumbServer/PATH/%altthumb%' border=0>