What is the best way to load html as components? [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am currently working on a multiple pages website. I find it foolish to have to go into every html file to make simple changes to the header and footer. I am thinking about jquery load method but I hate using it. How should I go about doing this without without jquery.

Like the other comments have said, there are multiple ways to do this.
As pointed out by User Daniel Chung, a good choice for this situation is using a website framework. I personally use Laravel Blade as it's a well-documented framework and is great for beginners. Laravel uses PHP and handles the backend. However, it includes Blade which uses html to do the frontend, this way you could use #extends('template') in your blade file, allowing you to pull in data from other blade(html) documents. More info here.
You could also use frontend frameworks like Vue.js or Next.js.
If you don't want to worry about frameworks, there are other ways to solve this problem. As user ikiK mentioned, using PHP includes allows you to perform just this. This link from W3Schools is very useful and the first example they provide is basically exactly what you want.
I would recommend trying out some of the frameworks if you are building a complex website but if you need a simple fix, the PHP includes is the way to go.

Related

I need information and in which language it is coded, help me if you have time [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to display my product like this : with selection step by step
https://www.wefix.net/pages/marques?type=phone
I don't now how to do it, is this javascript and PHP or jQuery and PHP ? How it's called ? if somebody have time to help, I would be grateful.
I have checked the link you have mentioned. By inspecting, it looks like it is built in a .Net framework using Shopify. They have also used jQuery in it.
If you want to build a web application, there are many options are available to build a web application. Like you can use .Net MVC, PHP, Python, Angular, React, etc.
All the languages have their own pros and cons. You should select the option based on your requirements and which is less complex as per your expertise.
Payment gateway integration and designing can be done as per your requirement in all the languages. So, that can not be a barrier to select a language.
It's called the steps left pattern and can be achieved in pure html and css.
Here is an example using bootstrap (You do not need Bootstrap for this).

How is the best combination for Laravel VueJs? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
actually i just learn about Vue.js and i have some knowledge using Laravel. I want to combine both of them, im searching for tutorials on internet and i found 2 kind of combination.
the first one is they separate Laravel and Vue, and the second one they combine both of them in Laravel Directory. Which one is the best for use guys? and can you guys tell me what is the benefits of each other? thank you so much.
These are different types of frameworks. You can build a nice UI independently. Yes, you can use both together. In your case, the Laravel will be API backend.
That don't have to be SSR. A Vue.js project can work with any API backend if you can. For example, you have developed a CRM front-end. Its backend can develop using Laravel or .NET Core. Vue doesn't care about it.
If the returned results are the same, you don't need to spend more effort.
What's the SPA?
A single-page application works in the browser and requires no page reloads and no extra time for waiting. The page doesn’t need to be updated since the content is downloaded automatically.
You already use these types of applications every day. Twitter, Trello, Facebook, Gmail, etc.
Actually, if your project needs to Vue.js, use it. In this case, you should ask this question yourself, "Why do we need a Single Page Application?".
The answer to the second question, yes you can. But you don't need to put them to the same directory.
As I said, benefits depend on your project's needs. Enterprise applications are could want to have different microservices, layers, etc.
Laravel and similar frameworks helping these kinds of needs.
I hope these pieces of information could help you.
Why do we need a Single Page Applications
Single-page application vs. Multi-page application
Single Page Application: advantages and disadvantages

The best way to pass data from vanilla Javascript to React? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am integrating some react+redux code into a website that is made completely in vanilla JS(with some JQuery), CSS, and HTML. The plan is to integrate the entire website into React, but won’t be complete for awhile and for right now the best plan is to integrate the required react code into the current stack. This would be easy if both the react code and the vanilla JS code didn’t have to communicate with each other, but that unfortunately isn’t the case. In particular, I need to be able to pass some of the data from all the vanilla JS already written into particular React components. I am having trouble in deciding the best way to do this. I found this great article which explains how to do this with a publisher/subscriber method, linked here:
http://www.primaryobjects.com/2017/05/08/integrating-react-with-an-existing-jquery-web-application/
This way seems fine, but it is a little convoluted for my use case and will require some significant code refactoring in order to implement properly. Is there an alternative way to accomplish my goal?
NOTE: The React code uses JSX and not JS.
The best way I can think of is a global state management like redux where you can store the data. Subscribe the react components, and the vanilla JS modules to the store which will enable data to be shared across both.

Does Javascript and Jquery languages are enough to make a working web messenger application? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Can we make a web based messenger application through the use of just these two languages javascript and jquery?
You will at least need to learn some basics of HTML as well.
(Hopefully) you also want to style your application, which means you should learn at least some CSS.
As far as programming languages go you will however need to know JavaScript and can use jQuery (among other things) to manipulate DOM.
Many modern applications however user React or Angular heavily to make the application building process easier in the long run.
You will also need to store your data somewhere, which means either server-side code and learning how to use a database such as mySQL, MongoDB or CouchDB to name a few (noSQL such as MongoDB or CouchDB are probably more appropriate for a messaging app). Or make it easier on yourself and use Firebase or something similar to store and retrieve data as well as handle user account and authentication.
I know all this may seem overwhelming, but making web apps involves a lot of moving parts.
SUMMARY
If you are starting out, I would recommend simpler challenges than a web app, but if that is what you are set on, the easiest in my opinion would be:
HTML + CSS + JQUERY (this is how your app UI is handled)
JAVASCRIPT (connects UI and data)
FIREBASE (stores data and enables user management and authentification)
Resources to help you get started:
https://www.codecademy.com
https://firebase.google.com

Which is the suitable javascript framework to develop Single page application with php as backend? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
We want to create a single page application with php as backend language. Which javascript framework would be a suitable one to develop this?
This question is too subjective and probably going to get flagged. Based on my recent experience trying to convert a yii app to angular frontend, this is my two cents..
Yii is great framework but as soon as you start adding intermediate to advanced Javascript and ajax functionality things start breaking down in unexpected ways, especially with IE and other older browsers, it becomes more even complicated if you are using lot of Yii extensions for popular jquery/js plugins. This is perhaps because Yii's internal JS functions are not really configurable especially with widgets both Yii's and third party.
A single page app using AngularJS/Yii does not really require Yii. If you are using angularJS then almost all data is passed via JSON. Essentially Yii becomes an API engine. Yii is bit heavy for an API only scenario. There are much simpler frameworks which are built specifically for APIs .
Having said that you should perhaps consider using this combination if you are comfortable with Yii do not really want to learn a new backend framework, or have an existing project in Yii which you want to convert to AngularJS.
There is project template for using along with BackboneJS for single page applications you can check it out here https://github.com/clevertech/YiiBackboneBoilerplate
It will give you some idea on how to integrate a Javascript framework with Yii

Categories

Resources