PHP template for features

Installing features for the first time

  1. For each feature, create images with the correct dimensions and save them on your web server:
    • ANU window homepage features: 320 by 215 pixels
    • Standard no window features: 320 by 215 pixels
    • Wide side features: 320 by 160 pixels
    • Narrow side features: 200 by 200 pixels
    • Four feature block - multiple copies of your images are required:
      • Large size: 470x270px
      • Large size (full screen): 640x360px
      • Responsive size:280x360px
      • Thumbnail size:90x90px
    Note that the ANU window will appear automatically over your image if you have selected the ANU window homepage feature type (see below).
  2. Save features.php and settings_features.php on your web server in the same folder.
  3. Edit settings_features.php and complete the title, excerpt, url and image for each feature. The parts you need to update will be included within ***. Make sure you fill out the arrays corresponding to the type of feature rotator you are using. That is, if you are inserting the ANU window homepage feature, fill out the details in $feature_array. For the wide side feature, fill out the details in $feature_array_wide, etc.
    If you need more features, copy the section of code from // start of feature... to "), on the images row and paste it above // end of features array - do not update code below this point //. Similarly, to remove any features you don't need, delete from // start of feature... to "),
  4. Edit the page where the feature is to appear. Beneath include $Menu; insert include ('features.php'); where features.php is the name and location of your features file.
  5. Next you need to include the call to the PHP function which displays the feature rotator. The placement of this line of code depends on what kind of feature you are inserting:
    1. If you want to insert a full width feature, with or without the ANU window, one of the following lines of code must be inserted on the line after include ('features.php'). It is not within a grid class and will appear at the top of your webpage:

      printFeaturesOrig(); // ANU window homepage feature
      printFeaturesNoWindow(); // standard no window feature printFeatures4(); // Four features, with preview images on right

    2. If you want to insert a narrow or wide side feature or a news ticker, insert one of the following lines of code in the place on the page where you would like the feature to appear. It must be enclosed in PHP tags <?php and ?> and be within an appropriate grid class :

      printFeaturesVertical(''); // narrow vertical feature, place inside a 'narrow' div

      printFeaturesVertical('-w'); // wide vertical feature, place inside a 'wide' div

      printFeaturesTicker(); // news ticker, place inside in a 'doublewide' div

      For example, to insert a narrow side feature:

      <div class="narrow"><?php printFeaturesVertical(); ?></div>
    3. You can insert different types of features on the same page by following both a. and b.
  6. From this point onwards, you need only update settings_features.php regularly to change the features appearing on your homepage.
Need to disable features temporarily? Put forward slashes in front of the print statement to stop features from displaying. For example, to disable the ANU window feature temporarily, your code should look like: //printFeaturesOrig();

Converting existing features to the new style

Note: You will need to change several files in this upgrade, so if you do this on your live site, your site may not display features for a few minutes as you make the changes. It would be better to upgrade on a development site, and then move all the changes at once to your live site.

  1. Copy in the new 'features.php' file from the new template. It is in the 'optional/features' directory of the zip file. It should be replacing an existing file called features.php in your site.
  2. Open up your PHP file for your homepage. This will most likely be index.php. Near the top of the file, there should be a line of PHP code:
    include ('features.php');

    After this line, add another line of php code:
    printFeaturesOrig();

    Save the file, and you should have the new feature rotator. You can tell if it is the new one, because it should have a round pause button next to the feature numbers.

  3. If you want to change the look of the feature block, download the new version of settings_features.php and fill out the arrays which correspond to the type of feature rotator you are using. That is, if you are inserting the standard no window feature, fill out the details in $feature_array. For the wide side feature, fill out the details in $feature_array_wide, etc. Also ensure that the images have the correct dimensions, as described above.

    You then need to replace the PHP call printFeaturesOrig(); with one of the following:

    • printFeatures4(); // Four features, with preview images on right
    • printFeaturesNoWindow(); // full width features, with no 'ANU' overlay on the images
    • printFeaturesVertical(''); // a narrow vertical feature, place inside a 'narrow' div
    • printFeaturesVertical('-w'); // a wide vertical feature, place inside a 'wide' div
    • printFeaturesTicker(); // a news ticker, which should be placed in a 'doublewide' div

    Note that the no window feature should be inserted at the top of the page, after include ('features.php'), but the other types can be inserted anywhere in the page, within an appropriate grid class as described above.

Updated:  18 August 2017/ Responsible Officer:  Director Marketing/ Page Contact:  Webstyle