The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "SVG" Oct 14 - 6:30 PM Eastern
Get a free trial // Grow your CSS skills // Land your dream job

Proper Way / Good practice in Coding php and html/css

  • # April 3, 2009 at 2:13 am

    hi there,

    when a programmer saw my code in php and css.. he said that i should separate my codes..

    function fNavi() {
    $list = a class=’navi’ href=’#’>HOME;
    $list .= ]CONTACT;
    return $list;
    echo fNavi();

    and i dont understand what he was trying to tell me..he said it’s a wrong practice embedding the html/css tags in my php code.

    i really wanted to learn and improve my code in a professional way , good practice.

    can somebody help me…. thanks

    # April 3, 2009 at 10:24 am

    he might have meant to use the php tags

    < ?php function fNavi() { $list = ?> a class=’navi’ href=’#’>HOME;
    < ?php $list .= ] ?> CONTACT;
    < ?php return $list; } echo fNavi(); ?>
    # April 3, 2009 at 11:12 am

    Create your nav as normal html


    and save it as

    Then in your html page, where ever you want it to appear

    < ?php include (''); ?>

    Obviously you would save your html page with the .php extension. eg. index.php

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed