Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SA Toc / Anchors Plugin
#26
surasshu Wrote:The top blue-link thing with the #-style links is the toc-menu. As you can see it shows all 6 the titles despite having depth=3 in there.

EDIT: Tested a little more, it seems that none of the arguments I put in do anything. So my current guess is that it's getting filtered out by the theme or CSS somehow?

Very strange.
Can you give me the exact HTML source of that page,
And from health check your gs version and php version.
Thanks
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#27
Getsimple - 3.1
PHP Version - 5.2.17

Both are rated as OK (as is everything else)

Here is the complete html code for that test page:
Code:
<!doctype html>

<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->

<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->

<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->

<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

<head>

    <meta name="description" content="(% sa_toc depth= 3 %) (% sa_toc depth=1 %) (% sa_toc depth=2 %) (% sa_toc depth=2 %) Height1 Height2 Height3 Height4 Height5 Height6" />
<meta name="generator" content="GetSimple" />
<link rel="canonical" href="http://surasshu-sound.com/test-page/" />
<link href="http://surasshu-sound.com/plugins/LastTweet/lasttweet.css?v=3.1" rel="stylesheet" media="screen"><link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://surasshu-sound.com/rss/" />
    

  <link rel="shortcut icon" href="http://surasshu-sound.com/theme/mycompany/favicon.ico">

  <link rel="apple-touch-icon" href="http://surasshu-sound.com/theme/mycompany/apple-touch-icon.png">

  <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>

     Test page |

      Surasshu Sound  </title>

    <meta name="description" content="">

    <meta name="author" content="">



    <meta name="viewport" content="width=device-width">



    <link rel="stylesheet" href="http://surasshu-sound.com/theme/mycompany/style.css">



    <script src="http://surasshu-sound.com/theme/mycompany/js/libs/modernizr-2.5.3-respond-1.1.0.min.js"></script>

</head>

<body>

    

<div id="header-container">

        <div class="inheader">

    <header class="wrapper clearfix">

            <div id="title"><a href="http://surasshu-sound.com/" title="Surasshu Sound"><img src="http://surasshu-sound.com/theme/mycompany/customize/logo.png" title="logo" /></a></div>

            <div id="navz">

                <nav>

                <ul>

          <li class="index"><a href="http://surasshu-sound.com/" title="News &amp; Updates">Home</a></li>
<li class="music"><a href="http://surasshu-sound.com/music/" title="Music">Music</a></li>
<li class="services-portfolio"><a href="http://surasshu-sound.com/services-portfolio/" title="Services &amp; Resume">Services</a></li>
<li class="contact"><a href="http://surasshu-sound.com/contact/" title="Contact">Contact</a></li>
  

                </ul>

            </nav>

            </div>

        </header>

</div>

    </div>

<!-- breadcrumbs -->              
  <div id="breadcrumbs-container">    
      <div class="breadcrumbs wrapper clearfix" >                  
        <a href="http://surasshu-sound.com/">Home</a>
        <img src="http://surasshu-sound.com/theme/mycompany/img/arrow.png" alt=" - ">
         <b>
          Test page</b>            
      </div>
  </div>    
<!-- breadcrums end -->

    <div id="main-container">

        <div class="inmain">

    <div id="main" class="wrapper clearfix blank">

            

            <article>

        <header>

          <h1>Test page</h1>

                </header>

                <section>

                  

<head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head>

<p>
<ul>
<li> <a href="#-Height1">Height1</a>
<ul>
<li> <a href="#-Height2">Height2</a>
<ul>
<li> <a href="#-Height3">Height3</a>
<ul>
<li> <a href="#-Height4">Height4</a>
<ul>
<li> <a href="#-Height5">Height5</a>
<ul>
<li> <a href="#-Height6">Height6</a></li></ul>
</li></ul>
</li></ul>
</li></ul>
</li></ul>
</li></ul>



<ul>
<li> <a href="#-Height1">Height1</a>
<ul>
<li> <a href="#-Height2">Height2</a>
<ul>
<li> <a href="#-Height3">Height3</a>
<ul>
<li> <a href="#-Height4">Height4</a>
<ul>
<li> <a href="#-Height5">Height5</a>
<ul>
<li> <a href="#-Height6">Height6</a></li></ul>
</li></ul>
</li></ul>
</li></ul>
</li></ul>
</li></ul>



<ul>
<li> <a href="#-Height1">Height1</a>
<ul>
<li> <a href="#-Height2">Height2</a>
<ul>
<li> <a href="#-Height3">Height3</a>
<ul>
<li> <a href="#-Height4">Height4</a>
<ul>
<li> <a href="#-Height5">Height5</a>
<ul>
<li> <a href="#-Height6">Height6</a></li></ul>
</li></ul>
</li></ul>
</li></ul>
</li></ul>
</li></ul>



<ul>
<li> <a href="#-Height1">Height1</a>
<ul>
<li> <a href="#-Height2">Height2</a>
<ul>
<li> <a href="#-Height3">Height3</a>
<ul>
<li> <a href="#-Height4">Height4</a>
<ul>
<li> <a href="#-Height5">Height5</a>
<ul>
<li> <a href="#-Height6">Height6</a></li></ul>
</li></ul>
</li></ul>
</li></ul>
</li></ul>
</li></ul>

</p>
<h1 id="-Height1" title="Height1">Height1</h1>
<h2 id="-Height2" title="Height2">Height2</h2>
<h3 id="-Height3" title="Height3">Height3</h3>
<h4 id="-Height4" title="Height4">Height4</h4>
<h5 id="-Height5" title="Height5">Height5</h5>
<h6 id="-Height6" title="Height6">Height6</h6>


  

                </section>



            <p class="date">Last update: <time datetime="2012-04-16" pubdate>April 16th, 2012</time></p>



            </article>

    

        </div> <!-- #main -->

        </div>

    </div> <!-- #main-container -->



    <div id="footer-container">

        <footer class="wrapper">

      

       <div class="socialicons">

<!--
Social icons code
Edit url  for each icons or create custom component or use plugin
  -->      
      
<!--
end of Social icons code
-->

        </div>

              

       <div class="logofooter">

       <a href="http://surasshu-sound.com/" title="Surasshu Sound"><img src="http://surasshu-sound.com/theme/mycompany/customize/logo-bottom.png" title="logo"/></a>

       <a href="http://www.twitter.com/surasshu" title="Surasshu Sound"><img src="http://surasshu-sound.com/theme/mycompany/img/ico-twitter.png" title="twitter"/></a>

       <a href="http://www.facebook.com/surasshusound" title="Surasshu Sound"><img src="http://surasshu-sound.com/theme/mycompany/img/ico-facebook.png" title="facebook"/></a>

       <a href="http://surasshu.bandcamp.com" title="Surasshu Sound"><img src="http://surasshu-sound.com/theme/mycompany/img/ico-bandcamp.png" title="bandcamp"/></a>

       <a href="http://www.youtube.com/surasshusound" title="Surasshu Sound"><img src="http://surasshu-sound.com/theme/mycompany/img/ico-youtube.png" title="youtube"/></a>

       </div>

      

       <div id="navbottom">

         <ul>

           <li class="index"><a href="http://surasshu-sound.com/" title="News &amp; Updates">Home</a></li>
<li class="music"><a href="http://surasshu-sound.com/music/" title="Music">Music</a></li>
<li class="services-portfolio"><a href="http://surasshu-sound.com/services-portfolio/" title="Services &amp; Resume">Services</a></li>
<li class="contact"><a href="http://surasshu-sound.com/contact/" title="Contact">Contact</a></li>
         </ul>

<!--

Theme Credits

Please consider keeping the links to the developer and GetSimple if you use this theme

-->  

        2012

        <a href="http://surasshu-sound.com/" >

        Surasshu Sound</a>          <br />

        myCompany Theme by   <a href="http://www.pixelofficer.sk" >PixelOfficer</a><br />          

        <a href="http://get-simple.info/" target="_blank" >Powered by  GetSimple</a>            

       </div>

       <div id="rssbottom"><a href="http://www.surasshu-sound.com/rss" title="Surasshu Sound"><img src="http://surasshu-sound.com/theme/mycompany/img/ico-rss.png" title="RSS feed"/></a>

</div>

      

        </footer>

        <div class="clearfix"></div>

    </div>



<script src="http://surasshu-sound.com/theme/mycompany/js/script.js"></script>





</body>

</html>



<!-- www.000webhost.com Analytics Code -->

<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>

<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>

<!-- End Of Analytics Code -->
Here's the css: http://surasshu-sound.com/theme/mycompany/style.css

I suppose I could use something else, like <strong> or a <div> with some font elements, to achieve the same effect, but I'm sort of obsessed now.
"What really matters is what you like, not what you ARE like."
http://www.surasshu-sound.com
Reply
#28
Sorry I should have clarified, I mean the source of the GS page content, not the final output.
The editor has a source button you can click to see the source of the wysiwyg editor.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#29
I am using this code and it works fine. This is the source of my WYSIWYG editor.

Code:
(% sa_toc depth=1 %)
(% sa_toc depth=2 %)
(% sa_toc depth=3 %)
(% sa_toc depth=4 %)
<h1>
    Heading1</h1>
<h2>
    Heading2</h2>
<h3>
    Heading3</h3>
<h4>
    Heading4</h4>
<h5>
    Heading5</h5>
<h6>
    Heading6</h6>

You can try this and see if it gives you the arguments.

Code:
(% sa_toc depth=3 debug %)
It should output the arguments to your page.

The css has nothing to do with this issue, its as if my plugin is failing to parse the arguments.
I am trying to find out why.

Have you turned GS debug on ?
I think maybe I am using a function that is newer than your PHP version, but cant find it so far.
Maybe you'll get an error.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#30
Ooh, gotcha, the code was this:
Code:
(% sa_toc depth= 3 %)

(% sa_toc depth="1" %)

(% sa_toc "depth=2" %)

(% sa_toc depth=2 %)
<h1>Height1</h1>
<h2>Height2</h2>
<h3>Height3</h3>
<h4>Height4</h4>
<h5>Height5</h5>
<h6>Height6</h6>
Let me see if I can turn on debugging and get back to you...
"What really matters is what you like, not what you ARE like."
http://www.surasshu-sound.com
Reply
#31
surasshu Wrote:Ooh, gotcha, the code was this:
Code:
(% sa_toc depth= 3 %)

(% sa_toc depth="1" %)

(% sa_toc "depth=2" %)

(% sa_toc depth=2 %)
<h1>Height1</h1>
<h2>Height2</h2>
<h3>Height3</h3>
<h4>Height4</h4>
<h5>Height5</h5>
<h6>Height6</h6>
Let me see if I can turn on debugging and get back to you...

I am on 5.2.14, and that works fine for me.
Except for the "depth=2" which is invalid syntax of course.

I wonder if its something else, like another plugin conflicting.

Hopefully those 2 debug suggestions provide some insight so i can get this fixed for you if its my issue.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#32
Hi,

how can I get it working in header or in sidebar ? Do I need to call add_toc function directly ? I want to create a page using Twitter bootstrap with Scrollspy and this looks perfect for it.

(or is it possible to join all pages into single, where all menu items are displayed as regular menu and clicking them scrolls to beginning of joined page?)
Reply
#33
morvy Wrote:Hi,

how can I get it working in header or in sidebar ? Do I need to call add_toc function directly ? I want to create a page using Twitter bootstrap with Scrollspy and this looks perfect for it.

(or is it possible to join all pages into single, where all menu items are displayed as regular menu and clicking them scrolls to beginning of joined page?)

Is this what you mean?
http://twitter.github.com/bootstrap/java...#scrollspy

Not yet, this version only supports a menu for same page anchors, and can only be called form inside the pages content.

I hope to add support for that in the near future.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#34
yes, I mean that exactly. it won't be problem to style and enable it on basic <ul> menu, only problem is displaying it in header / sidebar

EDIT:
well, I realized, that there is no need to display it in header. if it's single page website, there is no default menu, so don't display menu item at all and put sa_toc in div with menu id...
Reply
#35
found little problem with plugin:

it generates another <head> and <meta charset> tags. I see that without charset it behaves badly, but there is no way of removing ? <head> can be removed easily, (added tags in your replace where html and body were replaced)

EDIT:

so I've modified plugin this way and it looks like it's OK and UTF-8 is preserved too (would be glad that somebody tests it too, Slovak UTF-8 characters work)
Code:
#76 return substr($contents,68);

Code:
#224 $html_fragment = preg_replace('/^<!DOCTYPE.+?>/', '', str_replace( array('<html>', '</html>', '<body>', '</body>', '<head>', '</head>'), array('', '', '', '', '', ''), $dom_document->saveHTML()));
Reply
#36
Yeah that is a little pain in the ass trick to get the xmldoc to work properly, since you can't pass a doctype directly to it.

Ill get this fixed, thanks.

The substr method wnot work prior to php 5.2.6 since it doesnt add this junk to the output.

This is all you need to modify.

Code:
223    $html_fragment = preg_replace('/^<!DOCTYPE.+?>|<head.*?>(.*)?<\/head>/i', '', str_replace( array('<html>', '</html>', '<body>', '</body>'), array('', '', '', ''), $dom_document->saveHTML()));
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#37
thanks for your tip, but this fix doesn't work, it breaks characters "ž" -> "3/4" etc.
Reply
#38
morvy Wrote:thanks for your tip, but this fix doesn't work, it breaks characters "ž" -> "3/4" etc.

oops yeah thats not working at all, I must have goofed, let me fix again.

Do you have a page I can steal your utf-8 content from to test with ?

ok duh.

I have to ad the charset back in for the other function since its being removed now.

so in addition to that change add this also.

Code:
# 282
--    @$dom_document->loadHTML($contents);    
++  @$dom_document->loadHTML('<meta http-equiv="content-type" content="text/html; charset=utf-8">' . $contents);
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#39
Shawn: any chances that you thought about adding pagination (based on f.e. jquery) to TOC plug?
Addons: getsimple theme, Online Visitors, Notepad
Reply
#40
That would be nice, my documentations pages get pretty long sometimes.

Something like pagify, or did you have something else in mind ?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#41
Pagify is great. For very long texts you might also look at this one: http://beneverard.github.com/jqPagination/
As having more than ten 1|2|3|... buttons might be overwhelming.

Despite Next|prev (arrow) buttons at the bottom, pagination could also show shortened page's name to which those buttons lead.
Addons: getsimple theme, Online Visitors, Notepad
Reply
#42
Just a small UI suggestion:
changing $list = "ul class=\"toc\""; => $list = "ul class=\"toc\" rel=\"contents\""; allows to stylize the TOC list with css, and let know search engines that TOC menu is related to page's content.
I thought also about adding TOC header (automatically or manually - as an argument) as a first li element like:
Code:
<abbr title="Table Of Contents">TOC</abbr>

edit:
I found out that TOC is being rendered on i18n search serp, and shows a menu consisting of result pages' headers (h3). Is there a way to prevent such behaviour ? I thought that setting depth=5 variable (I used h5 on pages) should solve it. But either I am missing something, or misinterpret meaning of this variable.

Of course this happens when I invoke TOC at the beginning of the page - when the code is grabbed for search excerpts. From the other hand i18n search shows in excerpts every plugin call (even search form's code) but only TOC renders the output. Rest of plugins shows only their code.
Addons: getsimple theme, Online Visitors, Notepad
Reply
#43
Not sure I understand, anything that uses excerpts is of course going to include inline code re placers.
Whether that plugin executes content filters is up to it.

Maybe excerpt plugins should make use of filters to remove stuff you don't want in excerpts.

Not sure what I can do about it, unless there is some global present from the plugin I can check for and do nothing. "insearch" or something.

Of course this could all be done by end users with some component instead.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#44
Yeah I was going to ask Mvlcek if he has an idea how to filter out the calls to even his own plugins in search results.
All I can come up now is to wrap the calls around a container and hide it on SERP, but it won't prevent the TOC plugin from being rendered Wink
Addons: getsimple theme, Online Visitors, Notepad
Reply
#45
Someone did just post a custom search component that filters codes. Cant recall where I saw it in forums.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#46
I encountered problems with custom search on a special pages through a component, although it is the only way to cut off known strings in a search loop I can remind. I have to make more extensive tests when I find some spare time for playing with GS.
Addons: getsimple theme, Online Visitors, Notepad
Reply
#47
@yojoe, @shawn_a:
As far as I understand you are talking about two problems:
  1. a toc of the search results is shown - as I understand the toc plugin this would only happen, if you have (% sa_toc %) in your search results page? So it should be no problem?
  2. the search results contain placeholders, if using excerpts

As to 2: it's easy to replace the placeholders, but with what? ...? (...)?
I could add it to the search plugin (probably configurable) or you can do it in your custom component for the search item display.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#48
Tbh it happens in both cases, but for (% sa_toc %) plugins output is rendered, and we get a nice TOCs in SERPS Smile
Look at attached sshot. I forgot to delete tag from the page so it even shows the search code in serp.
I recall that somebody asked not that long time ago, how to get rid off i18n gallery code in search results in i18n gallery's thread.
But invoking the plugin inside a page's content would need to have an unified syntax in popular plugins (despite i18n), what has been talked long time ago.
If it would be possible to define beginning of a string (one in a line) to be filtered in search results, it would be surely a nice feature.
F.E:
(%
{%
...
Addons: getsimple theme, Online Visitors, Notepad
Reply
#49
(% %) is pretty unified
Only dynpages uses {} for historical reasons supposedly.

A simple regex to remove either from content.

Its not really a big deal.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#50
yojoe Wrote:Tbh it happens in both cases, but for (% sa_toc %) plugins output is rendered, and we get a nice TOCs in SERPS Smile

I understand: this happens because SA Toc is (on your installation) called after I18N Search. This could happen with other plugins, too.

But replacing the placeholders in I18N Search should fix this.

shawn_a Wrote:Only dynpages uses {} for historical reasons supposedly.

No, it has to be different, as the first name within does not specify a plugin, but a component. This way there can be no name clashes.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 1 Guest(s)