
Originally Posted by
misson
Out of curiosity, how are you integrating the subpage content into top-level pages? include?
No, otherwise i could just have set an global variable to check if it's called from within index.php (i believe).
At first i really wanted to do it C-style, something like
#define CALLEDFROMMAIN // in main .php
#ifndef CALLEDFROMMAIN // in getpage.php
// redirect stuff
(which was stupid..
)
index.php:
HTML Code:
<div class="article" id="article">
<div id="pageContainer">
</div>
</div>
<script type="text/javascript">
var dynPageObj = new DHTMLgoodies_scrollingPages();
dynPageObj.setTargetId('pageContainer');
dynPageObj.setUrl('getPage.php?pageNo=0');
dynPageObj.setScrollSpeed(10);
dynPageObj.loadPage();
</script>
getpage.php
PHP Code:
<?php
if(!isset($_GET['IwasCalledFromMain'])){
print '<script type="text/javascript">';
print '// redirect me..';
print '</script>';
}
if(isset($_GET['pageNo'])){
// just insert right after intro.html
$articles = array("intro.html", "undelete.html", "ftp.html");
$numofarticles = count($articles)-1;
if($_GET['pageNo']>=0 && $_GET['pageNo'] <= $numofarticles) {
include('articles/' . $articles[$_GET['pageNo']]);
if($_GET['pageNo'] > 0)
print ('go to <a href="#">Top</a> ');
}
if($_GET['pageNo']<$numofarticles){
echo "<a href=\"#\" onclick=\"dynPageObj.setUrl('getPage.php?pageNo=".($_GET['pageNo']+1)."');dynPageObj.loadPage();this.style.display='none';return false\">Next page</a> ";
}
}
?>
but have a look on it yourself if you want
ugly invalid html: http://j05t.co.cc/getPage.php?pageNo=1
main page: http://j05t.co.cc/ (just click on the penguin logo)
(still working on it.. sometimes ;) )