+ Reply to Thread
Results 1 to 3 of 3

Thread: Can I use Wiki.Page to somehow display a random section from a given page?

  1. #1

    Question Can I use Wiki.Page to somehow display a random section from a given page?

    Hello- Using Mindtouch Core on a local test server. We have a fun page in our Wiki called "Need a laugh?" Each video or picture on this page is separated into it's own section using headers. I would like to somehow randomly pull a section of this page into a section on our main page, either with every page load or once a day. Does anyone know how I could make this happen automatically? I'm new to mindtouch deki, but very impressed thus far. I just wish I had found it before we implemented our MediaWiki installation.

    Thanks for the help!

    Curt

  2. #2
    Join Date
    Oct 2008
    Location
    Basque Country
    Posts
    57

    Default

    hi Curt!! welcome to this community
    I've prepared a code in our SandBox pages with two samples, one to get all sections of a page and other to get a random section, yo can see its:
    - Source code of samples: http://gurework.com/MindTouch/SandBo...&action=source
    - Samples in action: http://gurework.com/MindTouch/SandBox/Page_Sections
    - The page that samples are using to get sections: http://gurework.com/OpenKoop
    If you want to maintain the same random page for a day, you could use WebCache cache functions, i've prepare another simple sample here:
    - Source code: http://gurework.com/MindTouch/SandBo...&action=source
    - Sample in action: http://gurework.com/MindTouch/SandBox/WebCache
    You can combine this cache sample with the previous random sample to get a different random page section every day
    happy sharing hugs!!
    Mikel - @himikel

  3. #3

    Default

    Awesome! Thanks Mikel!

    You'll have to excuse my ignorance, but I'm having a hard time understanding how/where to use the code.

    Here is what the source looks like on the SOURCE page:


    <h5>Gangnam Style</h5>
    <p>{{ media{ source: "http://www.youtube.com/watch?v=9bZkp7q19f0" } }}</p>
    <h5>Gang Fight</h5>
    <p>{{ media{ source: "http://www.youtube.com/watch?v=1GaKaGwch0U&amp;list=UU67f2Qf7FYhtoUIF4Sf2 9cA&amp;index=28&amp;feature=plpp_video" } }}</p>
    <h5>Russian Unicorn</h5>
    <p>{{ media{ source: "http://www.youtube.com/watch?v=YjaZNYSt7o0&amp;feature=relmfu" } }}</p>
    <h5>TV Bloopers</h5>
    <p>{{ media{ source: "http://www.youtube.com/watch?v=gVg2dQBi-wU" } }}</p>
    <h5>Batman Payton</h5>
    <p><img alt="payton_batman.jpg" class="internal default" src="/@api/deki/files/23/=payton_batman.jpg" /></p>


    As you can see, the sections are established using h5 headers. Is there a more efficient way to divide the sections so that it will work with your code?

    Also, for get random section, I see you have:

    Path: '/OpenKoop'
    Section #4 Len: 234


    That looks like you might be identifying the specific section and its length that you want to pull. Not just any random section from the given page "/OpenKoop". Is that correct? Where have I gone wrong?

    Thanks again for your assistance!!

    Curt

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts