Forums

  • med
    # December 30, 2008 at 4:29 pm

    Hi,

    sorry this isn’t css related, but if anyone can help that would be great.

    The content on some of my pages will be split into sections such as;

    Abstract
    Introduction
    Method
    …and so on.

    I would like the sidebar to contain links to these sections, anchored links to be precise. I can visualise how it’s going to work, but I’ve never really delved into php, only edited it here and there.

    So does anyone know how I can achieve this? This needs to be something generic of course so that it would work on any page.

    Actually while typing I’ve realised something, not all the content may have those precise headings, some may not have an introduction for example, so is there any way for the sidebar to pull these section headings from the page dynamically when it loads and generate a list of links based on the headings present?

    med
    # December 31, 2008 at 7:59 am

    Hey,

    thanks for all the replys!

    Quote:
    I just leaned over and asked one of the programmers on staff. Like you, I don’t do much server-side developing, so his answer was convoluted and complicated.

    Lol, doesn’t sound promising!

    Quote:
    I think he’s talking about dynamically generating a sidebar based on the html content of a page.

    Yep, that’s what I’m after.

    Quote:
    can you show us your page for us to see to get what your talking about?

    Here’s a diagramatic representation of what I mean (attachments aren’t uploading on the forum for some reason):

    [img]http://img213.imageshack.us/img213/9450/sidebar1sk3.png[/img]

    So essentially I want the sidebar to be able to pull the content headings from within the content and display them as a list, but also link to those headings. They’re normally called anchored links and are fairly straightforward, but integrating this into the sidebar is a little tricky.

    If all the content was uniform it wouldn’t be a problem. However, the content that the site is going to display will not follow one template, so the headings are bound to be different.

    I hope that explains it!

    med
    # December 31, 2008 at 9:58 am

    Hi,

    I have a dynamic widget sidebar on the right hand side, and as you mentioned it’s displaying recent content. The post is showing up as you indicated in the screenshot.

    med
    # December 31, 2008 at 10:19 am

    Instead of having recent content showing – these are individual posts, I’d like the sidebar to link to different paragraphs in one post only.

    If for instance I write a post about 3000 words long and it’s divided by subheadings like introduction, background, conclusion etc. I want the sidebar to be able to pick those subheadings from within that one post and display them as links. With so many words it becomes more convenient to be able to directly skip/jump to a specific part of the post rather than scrolling up and down.

    Is there any way I could define or class these headings so that they can be recognised and listed in the sidebar?

    med
    # December 31, 2008 at 10:44 am

    No problem, I tried posting there but nobody has replied yet. I’ll probably bump the topic. I’m thinking that assigning a class to the text might make it unique enough to pull out. I’ll see what I can do.

    But if anyone has any suggestions please let me know.

    med
    # December 31, 2008 at 12:38 pm

    Cool thanks for the advice. I can totally see how that will work, if everything else fails that’s what I’ll have to do. I’ve been looking at the documentation and wordpress call this ‘page jump‘.

    I’m going to try and delve into php over the next few weeks and see if I can get it to work. Here’s what I see in my head:

    Step 1. Locate/Find instance of <a name= within the html code. e.g. <a name=”unique-identifier”>Introduction</a>

    Step 2. Copy text within "" e.g. <a name=”unique-identifier”> and add to: <a href=”#add UI”>add UI</a> (Because the UI also = the subheading so can use it for both).

    Step 3. Repeat for all instances of <a name= within the html code.

    I just hope that particular instance isn’t used elsewhere in my pages or else I’m going to have a funny looking contents list.

    So anyway, that’s what I’m going to work around. I’m going to have to start from scratch because I don’t even know the php function to locate a word! Let alone add to the list…

    I’ll use google and the php site of course, but if anyone uses php and knows the functions that I should use please post here! Unfortunately this is only the beginning, I need to do add a few extra features to the sidebar, again specific to each post.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag