Results 1 to 8 of 8

Thread: Creating User Control In PHP (.ASCX)

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Creating User Control In PHP (.ASCX)

    Hi all,

    I was looking into a ASP .NET site which on all the pages had a menu down the side, and controlled other pages. I looked for the file and found out it was called nav.ascx. Apparently it's a user control file, can you do something like this with PHP?

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Try something like:

    Code:
    <?php
    
    include('path/to/your.file');
    
    ?>
    The above will include the contents of the file (in this case "your.file") into the page that you place the above code.

    Hope this is what you mean.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh yea so I could just set up a nav.php file or something? And add that into the pages?

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Exactly right, that is if that's what you were talking about in your first post. If not, you may have to be a little clearer (probably not perfect grammer, but oh well) on what it is you want to do.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well I mean ASP creates a special fancy file, but I guess php just does it more simpler, just by adding in whatever .php file you want to the page...

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    ASP.NET interferes with the HTML a lot and tries to smooth over the difference between client-side code and server-side code, which is a maintenence nightmare. PHP doesn't do any of this. If you want to write HTML, you write HTML: it doesn't create widgets or anything like that. This approach makes it slower going sometimes, but in the end tends to increase flexibility.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The only thing I liked about it was it sat on the left hand side and all the content displayed on the right... The nav.php file I include on all MY pages, makes all the info display below it... Is it just a HTML thing that I have to play with? I am a total newbie at php, adding the HTML is confusing me a bit...

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yup, that's purely an HTML/CSS issue. Examine the HTML generated by the ASP.NET script to get an idea of how to replicate it.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •