HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


[SOLVED!] How does one use the comcode "contents"?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#72085 (In Topic #15140)
Avatar

Community saint

Any assistance is greatly appreciated

Greetings,

Ok, I feel realy foolish that I can't figure this out, because I feel that this should be a very simple endeavor. However, I have racked my brain against this way too long now, and my head is starting to hurt, so I thought I best bring this question to the experts.

I have been making use of the CEDI system for my community "Encyclopedia Nor'Ova". It works great, and I even made a CEDI entry here about the basics of CEDI use.

There is just one thing that I have been wanting to do and trying to figure out, that has alluded me. That is, making those neat little table of contents, like found here on those tutorial pages that ocProducts has put up. You see, I have this terrible curse of going into detail and such, and make large sized CEDI pages for that. And since I break up my information on a page under headings, it would be great to have a Table of Contents on my large pages linking to each heading.

Well, using firebug, I went and decided to see if they were using some special magic to do that, and discovered that it was a comcode feature. Excited that I might have finally found the solution to the problem, I rushed over to edit my CEDI page: "Northern Chalcedonia". I went to "Comcode Tag Assistant" and scrolled down until I found "contents". I then tried and tried to set it up, but it's form was very archaic and written in martian, so I kept failing. Despite what I'd do, all I could ever get to show is the title "Table of Contents".

Well for now I have settled on just using a standard classic box, with the content links inside of it, but it is not what I really want. The box, you see, takes up the whole width of the page… but at least I have links to each heading (using the title_# html function and link to page anchor = if someone wants to know more on how to do that, I'll gladly share).

Anyways, I'd really like to know how to make the contents comcode work right, anyone know how and willing to share?

For informational purposes, here's the page I am trying to use this on…
Northern Chalcedonia


Last edit: by mythus

Legends of Nor'Ova: A site powered by ocPortal; home of the Legends of Nor'Ova tabletop RPG wiki and community.

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!

"Those who want help should first be willing to give help."
Back to the top
 
Posted
Rating:
#72101
Avatar

Turns out there was a bug that broke it.

Attachment
sources/comcode_renderer.php
» Download: comcode_renderer.php (95 Kb, 120 downloads so far)


To use, just put in [contents][/contents]

I have clarified the explanation of parameters for the next patch release.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#72111
Avatar

Community saint

Greetings,

Thanks for your fast response on this matter, but there is still an odd issue. While now I get a lovely contents box, it does something rather interesting. It replaces my five title links with three links that are completely worded different and go no where.

I would have the links as follows:
  1. The Situation with Magic
  2. Magic and its Effects on Flora and Fauna
  3. Survival is Possible
  4. Locations of the Past and the Present
  5. Climate
It changes my some magical means those locations (whether they have anchor links or not) to…
  1. Places of the Living
  2. Natural Places
  3. Places of the Past
While I appreciate that it is trying hard to think of cleaver title links, and linking them starting with title_8, which is way after my title links…. I'd wish it would just accept that I know best what is on the page.

Legends of Nor'Ova: A site powered by ocPortal; home of the Legends of Nor'Ova tabletop RPG wiki and community.

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!

"Those who want help should first be willing to give help."
Back to the top
 
Posted
Rating:
#72114
Avatar

This code has always been a bit dicey, as it has to do a double parse, and there are all kinds of weird conditions, like if multiple Comcode pages are loaded at once, that we've tried to protect from, plus the tag works in so many modes. Try this…

Attachment
» Download: comcode_renderer.php (95 Kb, 117 downloads so far)


This should fix the anchoring, but I have no idea where your alternative titles came from (I would guess something like if you are doing page inclusions). Maybe it will fix it anyway.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#72121
Avatar

Community saint

Greetings,

Chris, you have finally mastered cloning haven't you. Either that or you got one of those time-turner relics. I mean, how else is it that you can so quickly respond with a possible fix? Your promptness never ceases to astound me.

However, I am sad to say the fix didn't change anything.

I do know where it is getting those three odd links. It is taking the 3 h3 tags from the page, they are sub-headings to the Places of the Past and the Present section of the page. The main page headings are using h2 tags, since the page itself uses an h1 tag.

They are also the only three that I didn't link in the contents box. I didn't even make anchor links for them…

So I decided to try and remove the anchors. No go. I then went and cleared out the contents box, thinking maybe it wants to pull from the heading tags itself. No go. So for now, I just pulled back from my earlier revision, where I am using the box tag with anchor links stored within. I mean it is something that works, just not as eloquent looking as contents.

And, at least I know that this isn't not working because of my lack of understanding… don't feel so foolish now.

Legends of Nor'Ova: A site powered by ocPortal; home of the Legends of Nor'Ova tabletop RPG wiki and community.

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!

"Those who want help should first be willing to give help."
Back to the top
 
Posted
Rating:
#72137
Avatar

Community saint

mythus said

Greetings,

Chris, you have finally mastered cloning haven't you. Either that or you got one of those time-turner relics. I mean, how else is it that you can so quickly respond with a possible fix? Your promptness never ceases to astound me.

I'm beginning to think he already knows about every single bug but is waiting to see how long it takes us to find them. And once we find one, he just pulls a fix out of one of his folders and says "here, try this". He throws in "bad" fixes once in awhile just to throw us off.

Anyway… Chris, I think everyone here appreciates your (and your staff's) dedication and hard work even though its not said here much.

mythus said

However, I am sad to say the fix didn't change anything.

I do know where it is getting those three odd links. It is taking the 3 h3 tags from the page, they are sub-headings to the Places of the Past and the Present section of the page. The main page headings are using h2 tags, since the page itself uses an h1 tag.

They are also the only three that I didn't link in the contents box. I didn't even make anchor links for them…

So I decided to try and remove the anchors. No go. I then went and cleared out the contents box, thinking maybe it wants to pull from the heading tags itself. No go. So for now, I just pulled back from my earlier revision, where I am using the box tag with anchor links stored within. I mean it is something that works, just not as eloquent looking as contents.

And, at least I know that this isn't not working because of my lack of understanding… don't feel so foolish now.

I'm also following this thread with interest as this is something I'm thinking about implementing as well on my site.

Steve
Back to the top
 
Posted
Rating:
#72166
Avatar

Community saint

This is a very interesting topic!
Thank you Mythus for bringing it up.:thumbs:

I equally voice my appreciation to Chris for trying so hard to fix and improve on something really difficult for us mere mortals to absorb the coding implications fully.:cool:

Like sholzy, I'm also following this thread with interest since I'm already making good use of the CEDI system and this "contents" comcode is a formidable solution for adding clarity to complex series of posts.

Jean
Back to the top
 
Posted
Rating:
#72167
Avatar

Community saint

Me three!

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#72205
Avatar

I only wish I did know all outstanding bugs. I could just sit down and fix them all in bulk then  :lol: .

Attachment
sources/comcode_renderer.php
» Download: comcode_renderer.php (95 Kb, 118 downloads so far)


A couple of additional issues here stopped the code working when title levels were more than one deep.

Usage example:

Code

[contents][/contents]

[title="2"]test[/title]

[title="3"]test 3[/title]

[title="5"]test 5[/title]

[title="2"]test[/title]

(I just wrote this as a test case, with a few different title levels to make sure the code traversed them. I'm trying to demonstrate this is meant to be trivial to use, it works it all out from the existing title tags and needs no parameters)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#72215
Avatar

Community saint

Am I to imply that:

1.) We should use the…

Code

[title="2"]Title[/title]

Instead of

Code

[h2]Title[/h2]

2.) And that we do not need to make anchors and anchor links?

I just want to make sure I understand well how this works so that I can give you an accurate result on the status of this when I give it a shot.

Legends of Nor'Ova: A site powered by ocPortal; home of the Legends of Nor'Ova tabletop RPG wiki and community.

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!

"Those who want help should first be willing to give help."
Back to the top
 
Posted
Rating:
#72217
Avatar

Yes, it draws from Comcode 'title' tags.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#74941
Avatar

Community saint

Greetings,

Just wanted to state that due to inferior internet at the time and wave after wave of hetic busy stuff, I didn't get to try out the fix posted here. However, I can state that in the most recent version (7.1.5 I believe) this feature works! So great job! And much thanks!

Legends of Nor'Ova: A site powered by ocPortal; home of the Legends of Nor'Ova tabletop RPG wiki and community.

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!

"Those who want help should first be willing to give help."
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: