Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help adding an 'anchor' to a defined variable

Featured Replies

The test site I'm trying this out on, and the actual page I'm going on about is here:

 

See Example

 

and by the way - this site is no way finished...

 

I've got a guestbook script that I've positioned at the bottom of the page so that people can add comments about the artists ideas etc and I'm having problems with it. One of the main defined variables within the script is:

 

define('SELF',		$_SERVER['PHP_SELF']);

 

If you click on 'View Entries' or 'Add a Comment' on the page the script uses this for instance:

 

echo '<p><a href="'.SELF.'" class="bluebold" title="Click here to View Entries">View Entries</a> .: or :. <a href="'.SELF.'?func=sign" class="bluebold" title="Click here to Add a Comment">Add Comment</a><br /><hr />
</p>';
echo '<!-- guestbook -->';

 

The problem I've got is that when you click on 'View Entries' or 'Add Comment' the page is refreshed and goes back to the top and so you have to scroll down to the guestbook area - add a cooment or click view entries to see what I mean.

 

Joe Bloggs out there might not realise this and think there is something wrong with the page, so I thought, why not add an anchor to the guestbook area and this would solve the problem. But guess what - I have no idea how to do this and all my efforts and ideas have messed things up. It would be ideal to add the anchor within the defined variable "define('SELF', $_SERVER['PHP_SELF']);" at the top of the code and then it's generic to every main link.

 

Any ideas?

Need more code info? let me know...

  • Author

Not really

 

As there are several links and they all use the variable defined 'SELF'. I don't fancy going into the code and adjust every single link so I thought it might be possible to define it globally when the main variables are defined. Maybe you need to look at the file to understand what I mean. I think I've attached it OK.

 

sketchbook01.php

 

p.s. - I'll probably delete the file once I've got a solution if that's OK

  • 5 months later...
define('SELF',		$_SERVER['PHP_SELF']);

 

Any ideas?

Need more code info? let me know...

 

Have you tried something like...

 

 

define('SELF', $_SERVER['PHP_SELF'] . '#guestbook_id');

 

This should work for the View link... the other one will be tricky cos' of the querystring on the end!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.