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.

lcot

Members
  • Joined

  • Last visited

Reputation Activity

  1. Like
    One way is to have a config file (config.inc.php) that is included by all scripts that will define all your helper functions and site constants. In that file define your base url and base uri constants
    define ('BASE_URI', '/home/example/'); //remote path to root folder define ('BASE_URL', 'http://www.example.com/'); //live url //define ('BASE_URI', '/Applications/MAMP/htdocs/example/'); //local path to root folder //define ('BASE_URL', 'localhost/example/');//local url Then your include can be something like
    include(BASE_URI . 'assets/subbar.php'); Be sure to comment / uncomment out the 2 lines depending on whether you're working locally or remotely
  2. Like
    lcot reacted to gadgetgirl in Contact form php script build.. help?   
    You really want to do some validation on the form data. Look up php's filter_var - it makes validating email addresses easy. You will also want to ensure that your required fields are filled in, do some anti-spam processing and display helpful error messages. Look up htmlspecialchars() and strip_tags().
     
    As coded, you won't get the expected results because you've used $_POST['email'] and $_POST['email_address']. $_POST['email'] will never exist the way you've coded your form.
     
    One other thing, its bad form to use uppercase for variables.
  3. Like
    lcot reacted to gadgetgirl in php html template called to page - navbar query   
    Before you start coding you might want to mark up on a piece of paper the aspects of the page that are common to every page, for example Header, Footer and Sidebar. Create 3 files called header.html, footer.html and sidebar.html and insert the relevant code. In each page file you include the template file with the include function:
    include('views/header.html'); I usually put these files in a different folder so be sure to specify the full path. Your full page will look something like this
     
    <?php $page = 'index'; include ('views/header.html'); ?> <div class="some_class"> blah blah blah <p>ipsem lorem</p> </div> <?php include ('views/sidebar.html'); ?> <div class="another_class"> blah blah blah <p>more text</p> </div> <?php include ('views/footer.html'); ?> You can switch between php and html by using the php tags when you want to do some php coding.
     
    You will notice that I included a $page variable in the header file. This is to answer your second question. Set that variable in every page before you include the file that displays the navigation. Then when displaying the aspect that you want to have an 'active' class, check the variable first. One way to do navigation is to create an array of nav items and then loop through the array.
    $nav_items = array('index'=>'Home', 'events'=>'Events' ); foreach ($nav_items as $nav_href=>$nav_title) { if ($page == $nav_href) { echo '<li class="active">' . $nav_title . '</li>'; } else { echo '<li>' . $nav_title . '</li>'; } } Because you have a submenu you will need to have an if statement to cater for that. You should be able to fit that into the above skeleton code. Also with the above, be sure to get your use of single and double quotes correct.
     
    There are other ways to achieve the active class situation you're after including setting an id on each page's body tag but I find the above easy.

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.