I previously had someone build a website for me. It was 90% finished but then ill health got in the way.
I have all the files and I am now asking people to "put the website back together for me". The general consensus is that it's very messy and not clear what was done and some of the protocols are now out of date etc. And it would just be better to start from scratch. I have heard this from multiple people.
So now when I am asking a new guy to build it from scratch, he is asking me for the HTML files. I couldn't see any, so I contacted the previous developer and he said:
There are no HTML files, it all runs through the index.php file and
extracts pages, data etc. from the database.
I told this to the new developer, but he is saying:
But website is not possible without HTML. Ask him provide index HTML.
Pure HTML without php code.
I'm confused, because I saw the website up and running, so it seems it is possible without HTML?
I'm trying to figure out where the misunderstanding is happening.
Thanks.
What your previous developer is saying is that your site was dynamic and all requests were flowing through your index.php file, which in turn does some backend logic to produce HTML data for the browser to interpret. If you ask your previous developer to zip up the root of your old site, your new developer should be able to take it from there.
Can a website exist without HTML?
Without a .html file? Yes. Using only .php, .css and .js is possible.
Without using Hyper Text Mark-up Language? No. There ar no other mark-up language for browsers, afaik. So we're stuck with this.
Old dev used PHP for efficiency. Contents are in your database and fetched using php to show up in browser.
New dev probably only knows HTML and has no clue about php. Or, probably doesn't want to bother reading through the php codes to reverse engineer how your site works.
Suggestion: Get a different dev. A smarter one. You probably have to pay more, but it's more expensive to hire a less smarter dev.
I've been struggling with this for a while and eventually gave up on inpementing any sort of savegame option client side with my cocos2d javascript game (structure based on this tutorial http://www.raywenderlich.com/33028/how-to-make-a-cross-platform-game-with-cocos2d-javascript-tutorial-the-platforms .. thx Ray .. )
Now i'm trying to find a way to save xml files to a webserver while running my game, firstly in a browser (because that seems the most straightforward way to get this going) and then hopefully later as an app that can access that same webserver.
I have a fair idea how to generate the xml from my array objects and I realise php is my friend when it comes to writing that xml file to disk on the server side. I've even heard of his pal AJAX that seems to have his contact details : )
My biggest problem at the moment is that the AJAX exampes I have found all use jquery. I realise this might be to simplify the cross browser compatibility issues but I can't fiure out how to add JQuery functionality to the JS in my game (probably stupidly basic or impossible as it will mess up all the bindings, I don't know). Most examples assume were doing all this straight form a browser script so any help with that would be great.
If jquery is a no go , does anyone have and example of how to send xml data in any format to php?
I'm sure there are enough tutorials out there on how to hande things from there...
If there is a simpler or better way to save savegames locally or on a server using the cocos2d javascript idea i'd be happy to hear it.
Thx..
Edit
I have managed to figure out that the simple answer to the jquery option (at least when deploying to web) is to include jquery at the top of the cocos2d.js file where all the other js files are loaded... might not be a sound option when it comes to porting it all to iphone though.
sys.localstorage is the way to save data.
I know things like these have been asked and answered several times before, is it just that I can't grasp the idea easily or too hard to accept that things are really like this and that.
I know that HTML is used for Front-End where the tedious work is done in the Client, and PHP is working behind the scenes (Server-Side). With so many regulations, instruction, standards, so on and so forth.. I believed I have already confused myself with these stuffs, making things (new and old) hard for me to chew and understand especially when it comes to their best uses...
Anyway, I have created a web application based on the concept of MVC tho I didn't used the strong fundamentals of the topic nor a framework, I separated the Logic, Rules and Design concerns by my own.
Unfortunately, I wound up with some issues similar to which is the right way to do the things, how this should be implemented, etc...
I end up needing to template the HTML, however, since I've used HTML as HTML itself, I end up updating/editing each and every affected file (for. eg. a web page header), unlike when I used PHP before, literally a file with a .php extension, where I can fully utilize templating, however, i read somewhere that it is not a good practice because it breaks the HTML.. so which one should I follow and how can I solve my problem, should I move to .php and then create a template page, or is there a way I could do such with HTML? if there is any, how can it be done?
Please for the meantime, don't point me to frameworks available, I want to understand basic things first before studying frameworks...
Anyone, please...
Edit...
so this is just fine and that it doesn't have any drawbacks...
main.php
<?php php stuffs ?>
<html>
<body>
HTML stuffs and some <?php php stuffs ?>
</body>
</html>
HTML has no templating capability.
It has frames and iframes, but they come with significant drawbacks and only provide include functionality.
You should use a proper templating language. This can run on the client, server or build system.
I'd recommend against running it on the client. It adds an unnecessary dependency that your visitors (including search engine indexers) have to fulfil.
PHP will do the job (it straddles the border of being a programming language and a templating language). My personal preference is for Template-Toolkit.
TT can run in your build system via the ttree utility, or you can run it on your server. There is a tutorial covering how to build websites using it.
If, and when, you move to building websites with more demanding server side requirements, then you can continue to use TT as it is supported but most of the web frameworks in Perl land (e.g. the dancer module for TT and the catalyst module for TT. Note that those links go to the hardcode documentation for the modules, and if you plan to use one of the frameworks you should start with a higher level tutorial)
HTML is a markup language - in other words it can mark up text to display to the user.
It cannot do any of the dynamic type functions you might need in a web application - like updating the date, for example.
So it is best to think of HTML documents, just like you might think of a Word document, a load of text that is displayed to the user.
As soon as you want to start using templates to display dynamic information (stuff from a database, maybe), you're going to need a scripting language. PHP is good for this.
I've had good experience with Smarty - a php templating engine.
On a side note, learning a framework can be a really useful part of the learning the basics. Most frameworks force you to do things in a good way, and sometimes the things they make you write in your code may seem a bit strange or illogical, suddenly one day the penny will drop and you'll realise why what you've been forced to do is sound from an engineering point of view.
You can look # javascript templating. I suggest you to give a try to http://mustache.github.com/
Modest is a template system that's supposed to look and feel like HTML.
The most common way to do HTML templating with PHP, is to use one of these popular templating engines :
Smarty
Twig
Latte
Mustache
Alternatively, you can just put placeholders in your HTML that look something like <% variablename %>. Just load your HTML, do a regex do find all placeholders and replace them with the corresponding variables.
Alternatively, you can load your HTML, parse it as a DOM document and then modify your DOM. I created the library DOM Query to be able to do this with a jQuery-like syntax, but you could use vanilla PHP or one of several other libraries as well.
Alternatively, you can do some HTML templating in frontend with JavaScript. If you want to do HTML templating both on frontend and backend, you might want to consider using Mustache, because Mustache templates can be used both in frontend (with JavaScript) and in backend (with PHP).
I'm trying to traverse the whole PhoneGap thing to get a native app up and running. I am completely fine with creating html5 markup for the actual app, what I need help with is trying to pull in dynamic content from a website. In particular, there is some content on our website that also needs to be in the app. We use a program call Expression Engine that handles all of our content. The content that I would need to pull over would be:
Sermon Videos
Sermon Series
Locations
Plain text content
The majority of the app will be local, but there are some dynamic needs as you can see. I've read a couple things that say "JSON" is the way to go, but it looks pretty complicated as I'm not quite familiar with AJAX. Is this the only way or are there any options or resources anyone can point me to that might help. I'm not even sure if that method would work for our website. I appreciate any help you can provide.
They are correct. What you need to look into is AJAX/JSON and how to present your data to your app using these technologies.
Expression Engine would actually be quite a good choice for this as its template system is quite flexible. There are even add-on modules for delivering your content as JSON if you want t go that route.
A quick google led me to: http://samcroft.co.uk/2011/updated-loading-data-in-phonegap-using-jquery-1-5/
It's a bit more than you need since you will have your content in an existing CMS instead of creating a new database to store the data, but the concepts will hold true and I am sure you will be able to use it to find more tutorials that suit you better.
I'm making a search engine that (in theory) analyzes online encyclopedias to get answers to a user's question from a form. However, I want to know if I'm wasting my time with the PHP. If I am, what language would be best suited to this task? If I'm not, what function in PHP would allow me to do this? Thanks!
PHP works as well as anything else. If you want to read data off of another webpage, you'll probably want to use cURL, which is built in to PHP.
All of the requisite pieces are there: PHP does fine with processing text and HTML. If you already know PHP, it's best to stick with what you know.
This is easy enough to do with PHP. If the sites you are getting the data from are valid xhtml it will be extremely easy to process the page and extract the data using the simplexml extension.