Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6171217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:10:31+00:00 2026-05-23T23:10:31+00:00

I recently read the discussion https://stackoverflow.com/questions/62617/whats-the-best-way-to-separate-php-code-and-html I am facing a similar dilemma. Currently working

  • 0

I recently read the discussion https://stackoverflow.com/questions/62617/whats-the-best-way-to-separate-php-code-and-html

I am facing a similar dilemma.

Currently working on a WordPress website which has a LOT of sliders, animated dropdowns, forms and other components. Each of component is used multiple times throughout the website, so I’ve created a PHP file for each of these components and I use include to insert them wherever they are required.

Now the file I am including contains HTML & JS {for initializing control}

And finally when I looked at the generated html page in browser, it was chaotic! HTML & JS mixed everywhere!

I wanted to know if its better to include everything in one big JS file and include it on top of every page or its more efficient to have small JS blocks in the section?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:10:32+00:00Added an answer on May 23, 2026 at 11:10 pm

    In my opinion, if the HTML/JS is valid, there’s nothing wrong with it being a bit messy – the end user will never see it anyway. As for what’s best from a design point of view, it really depends on the situation.

    Personally, I think it’s alright to have a big JS file that’s included in every page, but some people prefer to output the code in small blocks where it’s needed. Ultimately, it really depends on what the program is and what works best for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently read in Code Complete that the recommended way of handling expressions that
I recently read (and unfortunately forgot where), that the best way to write operator=
I recently read a discussion regarding whether managed languages are slower (or faster) than
I've read a great deal of discussion recently (both on this site and elsewhere)
I recently read Object Oriented Exception Handling in Perl Perl.com article. Is there any
I recently read through Code Complete, and it recommends that I create a project
Recently read in a article on dotnetpearls.com here saying that static ctors take a
I recently read Michael C. Feathers' book Working effectively with legacy code and came
I recently read a jQuery tutorial about best practices. I usually run all my
I recently read about a new Google-code hosted (open source) project from Google that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.