plugnz14 Posted June 21, 2018 Share Posted June 21, 2018 Hi , having some fun trying to get my blog to refresh at a section on my page rather than the top of the page. I'm using Simple Blog PHP 3.0 script which uses a PHP include()to insert the blog entry on the page. The bit that posts the blog entry... Quote <a href="<?php echo $thisPage; ?>?pid=<?php echo $Newer_Post; ?>&p=<?php echo $_REQUEST['p']; ?>&cat_id=<?php echo $_REQUEST["cat_id"]; ?>&search=<?php echo urlencode($_REQUEST["search"]); ?><?php echo $anchor_blt; ?>" title="<?php ReadHTML($Post['post_title']); ?>"> <?php echo ReadDB($OptionsLang["Newer_Post"]); ?> <i class="fa fa-angle-right"></i> </a> and the bit that sends it back to itself Quote $thisPage = $_SERVER['PHP_SELF']; My page has sections, every time it refreshes back to the top of the page, with this in the address bar Quote http://www.ak-tiv.co.nz/ak-tivblog.php?pid=3&p= But I'd like it to go to the # Blog section of the page. So I've tried this..... Quote $thisPage = $_SERVER['PHP_SELF']. '#blog'; .....and it works! wahoo! Refreshes back to the blog section of the page and this bit in the address bar.... Quote http://www.ak-tiv.co.nz/ak-tivblog.php#blog?pid=3&p= but.... now the blog links don't work.... Any thoughts? I would be very much appreciative if someone could shed some light on this. Thanks in advance. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 21, 2018 Share Posted June 21, 2018 It's trying to echo a variable called $anchor_bit in the URL, you should set that variable to "#blog". The anchor goes at the end of the URL, not before the querystring. Link to comment Share on other sites More sharing options...
plugnz14 Posted June 21, 2018 Author Share Posted June 21, 2018 Justsomeguy, Thank you so much! That is awesome! Link to comment Share on other sites More sharing options...
plugnz14 Posted June 21, 2018 Author Share Posted June 21, 2018 Here was the offending variable..... Quote // adding anchor to URLs. Comment if no need of anchors //$comm_url = $url_vars."#comment"; $url_vars .= "#blog"; // adding anchor to URLs. Make it $anchor_blt = "#blt"; if you need anchors $anchor_blt = "#blog"; Thanks again for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now