Categories > TinyButStrong general >

Automatic scrooling

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Alan Lake
Date: 2014-04-04
Time: 14:40

Automatic scrooling

I have a PHP variable
$verse
.  This code uses TBS to create the HTML file.  What I need to do is to cause the HTML display to automatically scroll down to the place indicated.  Any suggestions as to how to do this?
class Gen02Controller implements RestController {
  function execute(RestServer $rest) {
    global $chapter, $verse;

    $verse = $rest->getRequest()->getGet()["v"];

    $curr_ref = "genesis_02";
    $location = PROJECT_ROOT_DIR.'app'.DS.'views'.DS;
    $curr_file = $location.$curr_ref.'.html';
    if (file_exists($curr_file)) {
      $chapter = file_get_contents($curr_file);
    }else{
      $chapter = "$curr_file doesn't exist";
    }

    $html_file = PROJECT_ROOT_DIR.'app'.DS.'views'.DS.'home.html';
    if(file_exists($html_file)) {
      $TBS =& new clsTinyButStrong;
      $TBS->LoadTemplate($html_file);
      $TBS->show(TBS_NOTHING);
      return new StringView($TBS->Source);
    }else{
      die("$html_file does not exist<br />");
    }
  }
}
By: Skrol29
Date: 2014-04-05
Time: 00:50

Re: Automatic scrooling

Hi,

This is rather an HTML question than a TBS question.
I can see two solution, :
1) add an anchor into the HTML, and add a # in the URL to go this anchor.
2) add Javascript in the HTML to perform the scroll down.

By: Alan Lake
Date: 2014-04-05
Time: 10:28

Re: Automatic scrooling

Thanks!  In fact, it seems to me that TBS solves all kinds of problems: HTML, PHP & Javascript. :)  I'm rather weak with Javascript, so I didn't see that solution.  I just wondered whether TBS had a solution for this problem.