Using PURE.js to fed the HTML with JSON - html

Can i use pure.js and jquery to display my HTML content via Json?
The reason is to check if anybody has used this method before and have been successful.
url for ref: http://beebole.com/pure/documentation/get-started/

I am not sure if you still are looking for an answer to this question but simply, yes, you can use pure.js with jQuery to display content from JSON objects. It is very well integrated with jQuery and it also works well with AJAX calls.
I've been using pure.js for several years and personally think it is one of best JavaScript template engines. But, it has some limitations so may not be good to solve all the problems.
I included some pure.js usage examples in some my answers e.g.
is it possible to insert new html with pure.js
jQuery iterate through JSON dictionary
If you made any attempts to integrate pure.js with jQuery and ran into problem, please share your code and we should be able to help you more.
I hope that will help.

Related

How can I pass form data from one html file to another without JS/PHP?

I'm learning basic web dev and started with HTML, CSS, Bootstrap. Haven't touched PHP or anything server side yet.
What I've done so far is I've created a pretty basic registration form with 5 fields and what I'm trying to do is display the input of those fields in a table that I've created on another page. The submit button has the "method" and action. Now, I've Googled a ton to find some solutions and have gone through most of the questions of this site but I still can't find out to achieve what I'm trying to do without the use of PHP/JS.
So, is it even possible to read form data from another page like this without the use of JS/PHP? If so, how do I proceed and what needs to be done? I can post the source code but I don't think it's going to help since there isn't much there, everything else is working fine except for finding a solution to this.
Thank you.
You need a programming language.
If you want to do it entirely client-side, then that has to be JS.
If you want to do it server-side (which allows you to access the data and, optionally, make it available to other people, instead of limiting it to the user of the browser) then you can use any programming language at all (although JS and PHP are among the most common choices).
Since you are trying to create a registration page, you'll need to use server-side programming.
You necessarily need to use JavaScript / PHP.
Since you are just starting, I would highly recommend you to check out the W3Schools tutorials on HTML, CSS, JavaScript, PHP, Bootstrap and jQuery.
:)
So this is long gone but I was actually able to resolve my problem without using anything other than basic HTML , so here's how I did it for anyone else who's trying to find the answer to problem (probably not, you don't usually do this professionally and basically this was a challenge from a friend).
So, two things.
SessionStorage
LocalStorage
This is built-in to your browser and you can use it to achieve simple tasks by simply assigning values to it. They'll remain there and you can use however you want.
But, as the name implies, sessionstorage will only retain those values during the session (the time you have your browser open for) while localstorage can retain it indefinitely. Not sure if I can link other sites over here so just Google these terms to learn more and how to use them.

I have created an html generating js function based on JSON. Is this more effective than templating engines or doing it manually by code?

Could you please check if this function is more effective from a coding point of view than templating engines or manually creating the html elements through code?
https://github.com/krishnakumar-m/simple-html-templating-json
I have checked github for use of JSON to generate HTML. But was not able to find any. I found this a bit more handy while dynamically generating html elements, because I was able to visualize the HTML as JSON.
Why are we not using JSON for structuring HTML this way? Is there a catch here? Or are there libraries which does the same thing?

How to repeat a menu without using iFrames or PHP in simple HTML/CSS or XML?

sorry for this ultimately newb question. I want to create a menu and not have to repeat the code of the menu on every single web page. I have done this with iframes in the past, but I know they aren't recommended. I have a pretty decent knowledge of HTML & CSS but I feel like I am missing something big here.
I am also not looking for the PHP solution which I believe is represented by:
<?php include("navigation.html"); ?>
Is there a good tutorial I can follow? I've heard this can be done with XML but I haven't been able to find what I am looking for exactly, and don't have any knowledge with it in the past.
In what I think is a related problem, I want to be able to place my google analytics code on just my index page and have it reference the entire website of pages, not just the index. Again, what am I missing here? Do I need to be using a content management system of some sort to pull off this slightly dynamic task? I don't think so...
Thanks for your help and please let me know if I can clarify my question any better!
Why don't you want to use PHP? It can be done with JavaScript (using AJAX), but you need to provide search engines with a way to crawl your site if you go that route.
Using includes in PHP to achieve this is simple and requires extremely little knowledge. Much easier and more efficient than doing it with JS. Also, I don't see how XML would be of any help here unless you read it in with JS (in which you'd have the same issue mentioned above.)
Use server side includes as mentioned already. They are support by pretty much all major webservers so php is not even required.
Check out the following articles:
http://en.wikipedia.org/wiki/Server_Side_Includes
http://httpd.apache.org/docs/1.3/howto/ssi.html (from apache, note no php needed)
http://www.boutell.com/newfaq/creating/include.html
Good Luck
I'm not really sure what options you have other than a .php include. I'm not sure of why you would be avoiding PHP unless the server didn't support it, as it's very simple to do an include (you really don't even need to know PHP to do this except for the include statement).
For your analytics code, you could put this in a .js file and just include it on every page:
<script type="text/javascript" src="analytics.js"></script>
Hope this was at least slightly helpful.
How about javascript? You could write a Javascript file that is included on each page that you wish to display the menu. The javascript could read an XML that contains your menu items and generates HTML to display the menu.
Parse and XML document with JS
http://www.w3schools.com/Xml/xml_parser.asp
jQuery menu solutions
http://speckyboy.com/2010/12/01/15-super-simple-jquery-menu-and-navigation-plugins/

is there any way to pass the values betwn the htmls without using any other language

is there any way to pass and get the values betwn the htmls without using any other language like js, jsp, php and others , only html.
simple answer NO
HTML is a markup language is only to create a view
nothing else
If you want to use only html the only thing you can do is display another page within your html using an iframe or frames. But I would not recommend those solutions. If you can get away with some javascript you can do way more with it. By you mentioning pass values it seems that you want to do some logic as the previous anwser stated HTML is only for the presentation layer.

Is there a utility function in Joomla 1.5 for rendering HTML tables? if so, please share

I am new to Joomla, so I was wondering if there is a function wherein I pass an array of headers and a two dimensional array for data (cells) and get the html markup required to display the same as a HTML table.
I am assuming since this approach works with Javascript frameworks, it should be available in Joomla too.
If something like that exists, I would expect it to be in the JHTML class, but I'm not seeing anything. Perhaps you can look through the API and find something to help:
JHTML class
If you don't find anything, I think you could easily write up your own method. Let me know if you need help doing so.