Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki

Move TOC

 

 

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded


wjmazza at gmail

Nov 17, 2009, 5:58 PM

Post #1 of 5 (1177 views)
Permalink
Move TOC

Is it change the location of the TOC 1) specific to a skin, 2) despite where
the user places __TOC__, 3) without using JavaScript, 4) without changing
the core code of MediaWiki, and 5) output it somewhere other then the
bodytext section.

Basically, I would like to have the rendered HTML output to be something
like this:

<div id="bodyContent">
<!-- Page Content goes here -->
</div>
<div id="sidebar">
<!-- TOC goes here -->
</div>

I see that in "includes/parser/parser.php" that Parser -> formatHeadings
takes care of creating the TOC but I do not want to change the actual core
code of MediaWiki (as this will affect other skins).

Any thoughts? Ideas?

Thanks all :)
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


g.briotti at gmail

Nov 18, 2009, 5:43 AM

Post #2 of 5 (1121 views)
Permalink
Re: Move TOC [In reply to]

> Message: 6
> Date: Tue, 17 Nov 2009 19:58:32 -0600
> From: Walter Mazza <wjmazza [at] gmail>
> Subject: [Mediawiki-l] Move TOC
> To: MediaWiki announcements and site admin list
>        <mediawiki-l [at] lists>
> Message-ID:
>        <35ca058b0911171758p3da48004he1e9d1bce42e0cff [at] mail>
> Content-Type: text/plain; charset=UTF-8
>
> Is it change the location of the TOC 1) specific to a skin, 2) despite where
> the user places __TOC__, 3) without using JavaScript, 4) without changing
> the core code of MediaWiki, and 5) output it somewhere other then the
> bodytext section.
>
> Basically, I would like to have the rendered HTML output to be something
> like this:
>
> <div id="bodyContent">
> <!-- Page Content goes here -->
> </div>
> <div id="sidebar">
> <!-- TOC goes here -->
> </div>
>
> I see that in "includes/parser/parser.php" that Parser -> formatHeadings
> takes care of creating the TOC but I do not want to change the actual core
> code of MediaWiki (as this will affect other skins).
>
> Any thoughts? Ideas?
>
> Thanks all :)

I'm not sure I understood... are you talking about moving the TOC as,
for instance,
in this page?

http://www.usnb.it/wiki/index.php?title=Pagina_principale

(the TOC is placed on top right side)

This can be achieved by a template with a div and __TOC__ magic word

G.


--

Giuseppe Briotti
g.briotti [at] gmail

"Alme Sol, curru nitido diem qui
promis et celas aliusque et idem
nasceris, possis nihil urbe Roma
visere maius."
(Orazio)

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


wjmazza at gmail

Nov 18, 2009, 10:38 AM

Post #3 of 5 (1118 views)
Permalink
Re: Move TOC [In reply to]

Sorry on the second read of my email, I realized I was kind of vague. I am
actually creating a custom skin that uses a 2 column layout. As part of this
layout, I would like to place the TOC in the "sidebar" (not to be confused
with MediaWiki:Sidebar)

So basically, the TOC needs to be placed OUTISIDE of the bodyContent div

HTML example:
<div id="bodyContent">
<table id="toc"><!--TOC is currently here --></table>
</div>
<div id="column-one">
<!-- I want to place TOC here -->
</div>

Thanks for your reply :)

Walter Mazza


On Wed, Nov 18, 2009 at 7:43 AM, Giuseppe Briotti <g.briotti [at] gmail>wrote:

> > Message: 6
> > Date: Tue, 17 Nov 2009 19:58:32 -0600
> > From: Walter Mazza <wjmazza [at] gmail>
> > Subject: [Mediawiki-l] Move TOC
> > To: MediaWiki announcements and site admin list
> > <mediawiki-l [at] lists>
> > Message-ID:
> > <35ca058b0911171758p3da48004he1e9d1bce42e0cff [at] mail>
> > Content-Type: text/plain; charset=UTF-8
> >
> > Is it change the location of the TOC 1) specific to a skin, 2) despite
> where
> > the user places __TOC__, 3) without using JavaScript, 4) without changing
> > the core code of MediaWiki, and 5) output it somewhere other then the
> > bodytext section.
> >
> > Basically, I would like to have the rendered HTML output to be something
> > like this:
> >
> > <div id="bodyContent">
> > <!-- Page Content goes here -->
> > </div>
> > <div id="sidebar">
> > <!-- TOC goes here -->
> > </div>
> >
> > I see that in "includes/parser/parser.php" that Parser -> formatHeadings
> > takes care of creating the TOC but I do not want to change the actual
> core
> > code of MediaWiki (as this will affect other skins).
> >
> > Any thoughts? Ideas?
> >
> > Thanks all :)
>
> I'm not sure I understood... are you talking about moving the TOC as,
> for instance,
> in this page?
>
> http://www.usnb.it/wiki/index.php?title=Pagina_principale
>
> (the TOC is placed on top right side)
>
> This can be achieved by a template with a div and __TOC__ magic word
>
> G.
>
>
> --
>
> Giuseppe Briotti
> g.briotti [at] gmail
>
> "Alme Sol, curru nitido diem qui
> promis et celas aliusque et idem
> nasceris, possis nihil urbe Roma
> visere maius."
> (Orazio)
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l [at] lists
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


nevinhoalarcao at gmail

Nov 18, 2009, 11:02 AM

Post #4 of 5 (1116 views)
Permalink
Re: Move TOC [In reply to]

Dear Giuseppe,
just out of curiosity, could you translate that latin quote under your
message ("Alme Sol,...")?
thanks, Nevio

2009/11/18 Giuseppe Briotti <g.briotti [at] gmail>

> > Message: 6
> > Date: Tue, 17 Nov 2009 19:58:32 -0600
> > From: Walter Mazza <wjmazza [at] gmail>
> > Subject: [Mediawiki-l] Move TOC
> > To: MediaWiki announcements and site admin list
> > <mediawiki-l [at] lists>
> > Message-ID:
> > <35ca058b0911171758p3da48004he1e9d1bce42e0cff [at] mail>
> > Content-Type: text/plain; charset=UTF-8
> >
> > Is it change the location of the TOC 1) specific to a skin, 2) despite
> where
> > the user places __TOC__, 3) without using JavaScript, 4) without changing
> > the core code of MediaWiki, and 5) output it somewhere other then the
> > bodytext section.
> >
> > Basically, I would like to have the rendered HTML output to be something
> > like this:
> >
> > <div id="bodyContent">
> > <!-- Page Content goes here -->
> > </div>
> > <div id="sidebar">
> > <!-- TOC goes here -->
> > </div>
> >
> > I see that in "includes/parser/parser.php" that Parser -> formatHeadings
> > takes care of creating the TOC but I do not want to change the actual
> core
> > code of MediaWiki (as this will affect other skins).
> >
> > Any thoughts? Ideas?
> >
> > Thanks all :)
>
> I'm not sure I understood... are you talking about moving the TOC as,
> for instance,
> in this page?
>
> http://www.usnb.it/wiki/index.php?title=Pagina_principale
>
> (the TOC is placed on top right side)
>
> This can be achieved by a template with a div and __TOC__ magic word
>
> G.
>
>
> --
>
> Giuseppe Briotti
> g.briotti [at] gmail
>
> "Alme Sol, curru nitido diem qui
> promis et celas aliusque et idem
> nasceris, possis nihil urbe Roma
> visere maius."
> (Orazio)
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l [at] lists
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>



--
{+}Nevinho
Venha para o Movimento Colaborativo http://sextapoetica.com.br !!
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


wjmazza at gmail

Nov 19, 2009, 10:09 AM

Post #5 of 5 (1115 views)
Permalink
Re: Move TOC [In reply to]

Just to properly resolve this thread, I found the solution to my question.
:)

Basically, all that needed to be done was to override the tocList function
found in Linker.php. The Linker class is the parent class of Skin, which is
the parent class of SkinTemplate, which is the parent class of any custom
skin you create.

So to grab the TOC, all I had to do was override the tocList function to 1)
save the generated TOC and 2) return nothing so no TOC is printed with the
body content.

class SkinMyCustomSkin extends SkinTemplate
{
var $skinname = 'MyCustomSkin',
$stylename = 'MyCustomSkin',
$template = 'MyCustomSkinTemplate',
$useHeadElement = false;
function tocList($toc) {
$this->savedTOC = parent::tocList($toc);
return "";
}
}

Now I can place the TOC where ever I want by simply "print
$this->skin->savedTOC;"

Walter Mazza


On Wed, Nov 18, 2009 at 12:38 PM, Walter Mazza <wjmazza [at] gmail> wrote:

> Sorry on the second read of my email, I realized I was kind of vague. I am
> actually creating a custom skin that uses a 2 column layout. As part of this
> layout, I would like to place the TOC in the "sidebar" (not to be confused
> with MediaWiki:Sidebar)
>
> So basically, the TOC needs to be placed OUTISIDE of the bodyContent div
>
> HTML example:
> <div id="bodyContent">
> <table id="toc"><!--TOC is currently here --></table>
> </div>
> <div id="column-one">
> <!-- I want to place TOC here -->
> </div>
>
> Thanks for your reply :)
>
> Walter Mazza
>
>
>
> On Wed, Nov 18, 2009 at 7:43 AM, Giuseppe Briotti <g.briotti [at] gmail>wrote:
>
>> > Message: 6
>> > Date: Tue, 17 Nov 2009 19:58:32 -0600
>> > From: Walter Mazza <wjmazza [at] gmail>
>> > Subject: [Mediawiki-l] Move TOC
>> > To: MediaWiki announcements and site admin list
>> > <mediawiki-l [at] lists>
>> > Message-ID:
>> > <35ca058b0911171758p3da48004he1e9d1bce42e0cff [at] mail>
>> > Content-Type: text/plain; charset=UTF-8
>> >
>> > Is it change the location of the TOC 1) specific to a skin, 2) despite
>> where
>> > the user places __TOC__, 3) without using JavaScript, 4) without
>> changing
>> > the core code of MediaWiki, and 5) output it somewhere other then the
>> > bodytext section.
>> >
>> > Basically, I would like to have the rendered HTML output to be something
>> > like this:
>> >
>> > <div id="bodyContent">
>> > <!-- Page Content goes here -->
>> > </div>
>> > <div id="sidebar">
>> > <!-- TOC goes here -->
>> > </div>
>> >
>> > I see that in "includes/parser/parser.php" that Parser -> formatHeadings
>> > takes care of creating the TOC but I do not want to change the actual
>> core
>> > code of MediaWiki (as this will affect other skins).
>> >
>> > Any thoughts? Ideas?
>> >
>> > Thanks all :)
>>
>> I'm not sure I understood... are you talking about moving the TOC as,
>> for instance,
>> in this page?
>>
>> http://www.usnb.it/wiki/index.php?title=Pagina_principale
>>
>> (the TOC is placed on top right side)
>>
>> This can be achieved by a template with a div and __TOC__ magic word
>>
>> G.
>>
>>
>> --
>>
>> Giuseppe Briotti
>> g.briotti [at] gmail
>>
>> "Alme Sol, curru nitido diem qui
>> promis et celas aliusque et idem
>> nasceris, possis nihil urbe Roma
>> visere maius."
>> (Orazio)
>>
>> _______________________________________________
>> MediaWiki-l mailing list
>> MediaWiki-l [at] lists
>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>
>
>
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Wikipedia mediawiki RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.