Erich,
You are amazing, awesome !
Erich,
You might also give an example with pipes and brackets to make working this:
appendLine="[[include include:page-count-append prepend=<strong>Community [[[system:pagecalendar|pages]]]: | append=in total</strong>]]"
> give an example with pipes and brackets to make working this
I've done so. You cannot add Wikidot tags to prepend=…, just HTML tags. And for an <a … you need to add the magic target=_parent to make it work properly — addressing the main window from within the iframe
I just notice that this will make it "trivial" to implement properly working file:// (or other non-supported) links via the same iframe method as here
Thanks for the third example.
I was just wondering whether you could intercept the result of this
[[module ListPages category="*" separate="false" limit="99999" perPage="99999" order="titleAsc"]]
%%category%%:\
[[/module]]
and within your javascript, store, count, order and printout the existing categories of a wiki.
> store, count, order and printout the existing categories of a wiki
Yes, should work — add a unique identifier between all the categories and write some JavaScript to split it, discard duplicates, sort, and display.
If you'd just like to see a list of all your Categories, consider using undocumented module Categories. As far as I know there's no way to configure its output.
When did you find this module Categories ?
I posted a wish http://pro.wikidot.com/ticket:274 for a PageCategory module on 22 March …
> I just notice that this will make it "trivial" to implement properly working file://
Never ever say “trivial”: I've implemented a method to code unsupported URL schemes (see my How-To) and — believe it or not — it works, except for file://.
This may be an intended (cross-site scripting) restriction, but I'm not knowledgeable enough in this area. Can anyone of you shed more light on this?
> When did you find this module Categories ?
Quite some time — maybe a year or more ago.
> I posted a wish http://pro.wikidot.com/ticket:274
I won't notice anything going on on pro.wikidot as it's locked for non-pro members.
> doesn't work in Safari 4.0 Beta
What does it do? Can you please explain details or post a screenshot? Does the console (do you have one on Safari) show JavaScript errors?
Oh sorry, that was really stupid of me. I usually get angry at other people who mention problems without describing them.
The HTML source code compared with Firefox 3 and Safari 4.0 beta is identical. The iframes still appear, however there is no text displayed. It's as though the javascript wasn't run/initiated. Here's an image where I have highlighted one of the iframes:
I have tried adjusting the height of the iframe to 100 pixels, just in case the text was there but simply displaced in the iframe. But that didn't work. It appears there is simply no text rendered by the javascript at all. I do not know if this is the case for Safari 3.
EDIT: The Safari debugging console says:
Unsafe JavaScript attempt to access frame with URL http://community.wdfiles.com/local--code/include:page-count-prepend/1 from frame with URL http://community.wikidot.com/howto:page-count. Domains, protocols and ports must match.
> Unsafe JavaScript attempt to access frame with URL …wdfiles…include:page-count-prepend/1 from frame with URL …howto:page-count
An iframe from a different domain cannot run JavaScript? Do I correctly read this? Does Safari work like this?
I'm absolutely no expert here, but as I understand, the whole reason that Wikidot development implemented this with two different domains was security. Any iframed JavaScript would be totally separated from the main page.
I'm absolutely no expert here, but as I understand, the whole reason that Wikidot development implemented this with two different domains was security. Any iframed JavaScript would be totally separated from the main page.
thats how i understand it.
so now im confused a bit, because there are lots of times when htmling something wont work because its calling for info from the original main page. So if it works on ff and ie it should in safari.
So if it doesn't work in safari then neither should this:
http://community.wikidot.com/blog:html-within-wikidot
but it does.
James, can you try to replace
url = document.URL;
url = 'url#XXXXXXX#before#after';
just to test what is causing the problem? I assume that Safari restricts cross-domain scripts to read a different frame's URL. The reason could be security: an unexpected script could spy on which pages you're browsing.
> So if it doesn't work in safari then neither should this: http://community.wikidot.com/blog:html-within-wikidot
I guess most iframed stuff doesn't try to read its URL, so it would work in Safari.
Please create a new page — otherwise there might be problems with caching (the old code still being used although you changed it). Please let me know.
I've fixed both the Page Count and the Iframe Link How-To's to work with Safari. Actually, I've just tested Safari 4, so James if you could test it with Safari 3 (just to confirm) please.
It was a nasty incompatibility between (supposedly equivalent) …wiki-name.wikidot.com/page-name/code/1#anchor-part and …wiki-name.wdfiles.com/local--code/page-name/1#anchor-part with Safari only correctly supporting the latter.
Can anyone please test both How-To's with IE7 & 8 and report back?
How do I make this work inline? I'm trying to display the counter at a collapsible block "SHOW / HIDE" field.
Does this also count redirect pages?
And if so, would it be possible not to count them?
The Spambot Death Wall
Arcana Wiki - Distilling the Real World for Gaming
Urbis - A World of Cities - an urban fantasy setting of industrial magic
LiveJournal
It counts all pages that do not start with an underscore (_).
It does use the ListPages module, so you would be able to restrict pages if you wish (such as redirect pages). This is possible if you tag all of your redirect pages with the tag "redirect"
Then, where you want the pages to be counted, put the attribute tags="-redirect". For example:
[[module ListPages category="food" tags="-redirect" separate="no" limit="10000" perPage="10000" prependLine="[[include include:page-count-prepend]]" appendLine="[[include include:page-count-append prepend=leading-text | append=trailing-text]]"]]
X[[/module]]
In the inc:page-count-prepend page, is this code:
var url = match[1]; var prepend = ''; var append = '';
In the first line above, is it necessary to initiate the 'url' variable when it's never used? Or is there something I missed?
Another thing:
Step 1
Create a page include:page-count-prepend with the following code.
Note:
- Replace community (first line of code) with the name of your Wiki
- Otherwise copy/paste the code exactly as-is, don't remove or change anything
[[embed]]<iframe src="http://community.wdfiles.com/local--code/include:page-count-prepend/1#\ [!--">
You could eliminate the code replacement step by using relative urls. I believe changing the code to this would work on any wiki:
[[embed]]<iframe src="/include:page-count-prepend/code#[!—">
This does direct it to http://yourwiki.wikidot.com/include:page-count-prepend/code, however. But this is not a problem, because Wikidot automatically redirects it to http://yourwiki.wdfiles.com/local--code/include:page-count-prepend, and the javascript code works in the "wdfiles" domain.
In case you weren't already aware, the suffix "/code" is automatically interpreted as "/code/1" in the wikidot domain, just as having no suffix is equivalent to "/1" in the wdfiles domain.
> You could eliminate the code replacement step by using relative urls
That's exactly what I had also thought when I developed the code. But if you use the http://wiki-name.wikidot.com/include:page-count-prepend/code style iframe URL instead of the http://wiki-name.wdfiles.com/local—code/include:page-count-prepend URL, you'll find that Safari doesn't render the iframe — the problem you detected.
See the example on Sandbox — most browsers are OK, but Safari fails.
> is it necessary to initiate the 'url' variable when it's never used?
No, it's not. I had jointly developed the two How-To's Page Count and Iframe Link and this line of code went dead for the Page Count How-To.
I've already removed it from the How-To. Thanks for finding this.
The only problem I had with this was that when I use a rss feed, it will take forever to propagate all the changes throughout. I added a test post, and it still shows that I have 2 posts, and not 3.
> The only problem I had with this was that when I use a rss feed, it will take forever
> I added a test post, and it still shows that I have 2 posts, and not 3
Can you give us more details? What exactly happens where? Maybe a link so that we can test?
Sure, here:
http://macfire.wikidot.com/sandbox:rsscount
It still only shows 2 pages. I have done 3 posts.
It still only shows 2 pages. I have done 3 posts.
Ahh, a small misunderstanding here: the page count module is designed to count pages, not forum posts.
The reason it gives the number 2 on your page, is because you didn't specify a category in your ListPages module. If you don't specify a category, Wikidot assumes you're talking about that page's category (in this case, sandbox). Low and behold, how many pages are in the sandbox category? 2
At the moment I'm trying to find a way to count forum posts/comments for you…
Must I put the name of the pages include:include….? Can i put some other category?
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
I personally HATE having pages to be included in a category called “include”:
Why? Because when it comes to programming, my thought processes are going “Now, we need to include the page-count-prepend page. Lets type that in…” and this is what I type:
[[include page-count-prepend]]
When my page doesn't work because Wikidot claims that my page doesn't exist, I am very confused. My brain thinks “Okay, did I type the page name wrong? Nope. Did I forget to write include? Nope”
That last thought process is wrong, I DID forget to write “include”, but when my brain was scanning the code, it registered that it is there.
When it comes to includes, I think its necessary to have them all in a category, but I call the category “inc”, short for “include”:
[[include inc:page-count-prepend]]
Your answer in short Brunhilda, yes, you can change the name of your include pages. But on your include:page-count-prepend page, don't forget to change in the first line of code /local—code/include:page-count-prepend/1# to the correct name of your page.
> When it comes to includes, I think its necessary to have them all in a category
You don't have to put all includes in a single category, just by convention we usually put them into “include”
I did everything by instructions (including the include category!), but the code does not work. It shows more pages of ART category than there are. There are 274 pages and it shows 294 pages.
Here, include:sandbox where the code is put:
http://istorijska-biblioteka.wikidot.com/include:sandbox
You shall also see that it does not support Cyrillic, and that is strange since there are lot of modules where I can change to Cyrillic the anchor text.
And here are two include pages. I will open the include category for you to be able to edit it.
http://istorijska-biblioteka.wikidot.com/include:page-count-prepend
http://istorijska-biblioteka.wikidot.com/include:page-count-append
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
I know why there are more pages! It counts also redirects! I must add somewhere tag="-преусмерење", because this prevents the module to count redirects. Is this possible, James?
EDIT: OK, I added it and now the number is ok. The only thing is that it does not support cyrillic.
Now, is it possible to avoid any kind of text? To have only a number, and the text in Cyrillic can be written outside of the module…
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
Yes, very easy =)
For this:
[[module ListPages criteria separate="no" limit="10000" perPage="10000" prependLine="[[include include:page-count-prepend]]" appendLine="[[include include:page-count-append prepend=leading-text | append=trailing-text]]"]]
X[[/module]]
Don't add any leading-text or trailing-text
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Hmm, the text in Cyrillic should work. Could you give us an example of some text that does not?
Now, is it possible to avoid any kind of text? To have only a number, and the text in Cyrillic can be written outside of the module…
Simply, yes. Just put a space in the prepend and append values. But the text you put outside the number would not be on the same line (it would be on the lines before and after)
Edit: Leiger beat me to it!
Hmm, the text in Cyrillic should work. Could you give us an example of some text that does not?
If you edit the Sandbox page, you'll see Текстови:.
Simply, yes. Just put a space in the prepend and append values.
Can you do that? I do not understand where I should do that exactly. You can edit the sandbox page, as a matter of fact I put all include category open to edit for all Wikidot members. But this only if it does not accept Cyrillic…
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
OK, I did that too… And it really seems that Cyrillic doesn't work… But, now, I would like to give size and color to that number… Is it possible? I tried to wrap it in div, but it did not work. I tried to add inside te module font-size but it didn't work…
EDIT:It seems that nothing works with this. You cannot put any design in it! Square brackets for centering to the page don't work with this either…
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
Meh, only just!Edit: Leiger beat me to it!
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
> it really seems that Cyrillic doesn't work
Unfortunately, Cyrillic text in prepend/append doesn't work in e. g. Firefox or Safari, although it works in Opera. I don't know yet how to solve this.
Does anyone of you JavaScript gurus know what JavaScript code would convert the (e. g.) “%D0%A2” in <iframe src="…include:page-count-prepend/1#X#%D0%A2" …"></iframe> so that it appears as Cyrillic text? The current code uses a simple unescape() which doesn't do the trick. I had also thought of adding <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> but that didn't help.
> give size and color to that number… Is it possible
To style the page count use HTML (not Wikidot) tags with prepend= and append=
Note that in e. g. <span style="font-size:75%; color:red"> any double quotes need to be escaped as %22, giving <span style=%22font-size:75%; color:red%22>
Color specifications like e. g. “color:#877E3D” do not work, as “#” cannot be used (neither as-is nor escaped as %23) within prepend= / append=
Note that if you want larger text, you may have to increase the iframe “height="18px"” in include:page-count-append, otherwise the text will get clipped by the iframe
> Square brackets for centering to the page don't work with this either
What you can do is, float it with [[div style="float:right"]]
Thank you Erich, so much, I have just seen what you've done at include:sandbox, but it seems so complicated, and I wanted to put counts for three caategories… I don't know if it is possible at all in a way I want… :(
The question is:
Note that if you want larger text, you may have to increase the iframe “height="18px"” in include:page-count-append, otherwse the text will get clipped by the iframe
Where is that iframe? And how do I include the height? How do I put it bold, and how do I put it in golden color?
PS: "float" inside div does not work if I want to put it in the center…
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
> Where is that iframe?
(For technical reasons) the iframe code is split between the two includes
- include:page-count-append
- include:page-count-prepend
> And how do I include the height?
The height="18px" is hardcoded in include:page-count-append, because I didn't want to make the code even more complex than it already is. You could easily change height="18px" to height="{$height}px" so that you can set the height individually on each include call appendLine="[[include include:page-count-append height=18 | prepend=… | append=…]]
> How do I put it bold
By using prepend=<strong> | append=</strong>. You can find an example for a bold page count in the How-To.
> how do I put it in golden color?
by using prepend=<span style=%22color:color-name%22> | append=</span>, where color-name can be one of the 16 Web Standard Color Names aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow or any of the Cross-Browser Color Names if the browsers you want to support, support them.
Ok… Now I managed to make it bold and to amplify the iframe, the color will stay black since there is no color that corresponds to my golden…
The only thing that stays is the position in the page… It seems that float:center doesn't work. I also tried page center and page-center, and it does not work…
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
Brunhilda, in the div try margin: 0 auto; text-align: center; (which is the same syntax I gave you a couple of days ago for a similar div centering issue :) )
Rob
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
My dear Rob! :D
I am hopeless case, I know, and I am so sorry, but I simply don't get very well what all those margins are for … :(
I put it in the div what you told me, but it does not work… The number is still on the left side….
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
Hmmm you're right. It must be to do with all that other stuff around it. I did manage to center the number with margin: 0 0 0 40%; (and leave out the text-align) but it's not exactly centered.
Rob
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
Now it works!!!! I put 47.5% and it is exactly in the middle…. :D
http://istorijska-biblioteka.wikidot.com/include:sandbox
Oh, Rob, thank you very much!!!!! And you too, Erich, for inventing this!!!
EDIT: Hm, it still has problems when i include that page into other page… But never mind, now I know how it works, so I'll find it the use…. :D
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
WOW !
We have the same problem with the "page count - do not center" on the handbook start page!
We put it in a table, in a second div, in a…
all did not help , the internal structure of the inlcude output destroys all what we have tried…..
Now - this is OVER!
Thanks Rob - and Brunhilda (you insisted on a solution of this problem) !
@Brunhilda: if you want to know the margin: styke attributes have a look on our new howto:
http://community.wikidot.com/howto:table-attributes
which explains the style="margin: 0 0 0 40%;" in a short way:
if the overall attribute "margin" is used than the following 4 numbers have this meaning:
1. margin-top
2 .margin-right
3. margin-bottom
4. margin-left ( = 40 % from left border of the "screen, frame, cell, window, a.s.o;
- easy to remember - from top clockwise around…
( this is the same with padding: ! )
for centering "something" you have to add the length of the included text!
Hope this helps?
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
I am familiar with most of those, but sometimes i don't get very well the padding… Sometimes, it simply does not behave as I expect :D…
Thanks, Helmuti, you're so helpful!
If slaughterhouses had glass walls, everyone would be vegan. - Paul McCartney
I think - the module counts only "250" documents before automatic pagination starts … have a look on the examples here above on the "howto" and on my output on the Handbook:
Something has changed in the internal counting/pagination process!
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
Pieter explained the reason for this:
http://community.wikidot.com/forum/t-173885/listpages-page-count-works-differently-sinve-this-morning#post-553884
I think this is ok and necessary…
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
On 5. August 2009 the ListPages Module has changed for security reasons:
If you use the Page count on a site with more than 250 pages over a given category ( or over all) - than you will get pagination!
I will insert the limit in the page too.
http://community.wikidot.com/syntax-changes is changed..
Now I know why the start page of handbook is so fast now!
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
On 5. August 2009 the ListPages Module has changed for security reasons
No, it's not SECURITY reasons… that would mean Wikidot had a security hole that could allow hackers to exploit the system through the ListPages module.
They changed it for PERFORMANCE reasons; too many resources were being taken up by this module — hence slowing down page compilation.
Of course - you are correct ..
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?