Announcement

Collapse
No announcement yet.

Using the PHP Module to include a fully formatted HTML page.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using the PHP Module to include a fully formatted HTML page.

    So I was using the HTML module to include static content on a page, and every time I want to edit it, there's numerous operations involved with SiteBuilder.

    Eventually I thought of using php include to just include the fully formatted web page, so I can edit it in DreamWeaver locally, upload it to the site and it automatically updates the contents of the page.

    So in the PHP Module, I have just something like:
    PHP Code:
    include('../vb_static/home.html'); 
    What I wondering is, in this topic HERE you talk about the HTML module, and how you are not supposed to included <head> and <body> sections and so on, yet I am including a full HTML page that has a <head> section with CSS links and javascript links, and the <body> tags and so on, and it works perfectly! No need to put anything in the 'head_include' template either.

    So I'm just wondering if there is anything wrong with how I'm doing this? It seems to work great.

  • #2
    There's a difference between what is correct practice and what works.

    You can make a webpage with pretty awful html in it and most browsers will probably load it, it doesn't make it properly coded though.

    If you included head and body tags then you effectively have two of each on your overall page. Whilst this may well work, it isn't good practice and could cause issues, particularly when embedding it within vBulletin. On the other hand if it has no ill effects and you're not bothered by incorrect coding then I wouldn't be too concerned.
    MARK.B | vBULLETIN SUPPORT

    TalkNewsUK - My vBulletin 5.4.0 Demo - FEATURING "ROUTE BY NODE"!
    AdminAmmo - My Cloud Demo

    Comment


    • #3
      Something to consider when using invalid HTML in terms of SEO...

      https://www.seroundtable.com/google-...ern-21556.html

      AutoLinker-vB5+vBCloud | Topic Starter Ribbon | Blur Replies for Guests | NavMenu Dropdown-vB5+vBCloud | TimedSticky | Events Module | Moderator List | Drag/Drop Upload

      Comment


      • #4
        Although visually it seems to work, you have to ensure that there is no error in the browser dev tools and all functionality is working. There may be unexpected results you haven't seen yet. There are more risks and unknowns with having an invalid HTML markup. And this is not a simple invalid HTML. Having multiple html, head and body tags is totally invalid HTML! Why not just do it the right way so there's nothing to worry about?

        AutoLinker-vB5+vBCloud | Topic Starter Ribbon | Blur Replies for Guests | NavMenu Dropdown-vB5+vBCloud | TimedSticky | Events Module | Moderator List | Drag/Drop Upload

        Comment


        • #5
          Glenn and Mark, you're absolutely correct. So I will not use this method, or (better yet) write some php to strip out the header and body tags. I've done it before; just have to dig up the code where I figured that out once before....

          Comment


          • #6
            So, I actually got that working. Wrote a PHP function that strips out any header information, and any <html> and <body> tags. So now you can use a PHP module to just include an existing fully-formatted .html web page into a VBulletin page, without having to copy and paste the HTML. Why would you want to do this? So you can work on it locally with a program like DreamWeaver, edit it to however you want it to appear, and then just upload it and the vBulletin site automatically includes it.

            Comment

            Working...
            X