PHP: How to make a good interface to create articles? - php

I would like to create an interface in my website with HTML and CSS so that the admin can make articles to be shown on the home page. But I don't how I could make the paragraphs and break-rows to seem correctly without being together.
What functions should I use or create to make a good validation?
I'm going to send the information from this interface to a database. From the database, I'll retrieve the information and show it on the home page.
Besides, do you have any suggestions to give me?

I'm not gonna lie; if you're new to PHP, building your own content management system will be difficult.
Learning is always a worthy goal. I suggest familiarizing yourself with the PHP documentation.
Start small. Build just the admin page first and see what you're in for. You'll probably want a rich text editor, username and password for the admin (NB - How to verify passwords properly!), etc.
For the line breaks and styling? Format paragraph elements using CSS.
For the interactive HTML and validation, if you are already familiar with HTML and the Javascript DOM, I would suggest learning to use a data binding library- AngularJS, Bootstrap, KnockoutJS or something similar. That will simplify your HTML interactions dramatically. If you are just a beginner, learn how to manipulate the page using Javascript.
I'm assuming you are familiar with databases in general? PHP works well with MySQL.
Search for what do you don't know. This isn't a tutorial site, but it isn't hard to find a tutorial to fill you in with exactly what you need.
On your journey, remember, search is your friend.

Related

How can I use PHP to return database data to an existing HTML page?

I am new to PHP. I know a little JavaScript, HTML, MySQL and lots of non-web computer programming.
I know how to create an HTML page with a form, use a button to call an external PHP file (with $_POST) which sends an email and records that forms data (names and email addresses) into a MySQL database.
Now, I'd like to create a new HTML page that calls an external PHP file (so the code is hidden) that will return the MySQL data (names and email addresses) for display on that existing HTML page (with all its CSS formatting and menus). In otherwise, I'd like to modify an existing HTML page with data (but hide the PHP code in an external file).
If this can be done (I'm new to this), can some please help by giving me at least the general idea so that I can build upon it. The textbooks that I've flipped through simply explain how to "echo" data back to the screen (a blank screen) with a .php extension in the address bar.
Thank you very much for your time and any help. I appreciate it!
Since you already have the html to echo part, you'll just need to plug it into the database.
Using a good ORM can help with this. For PHP, I recommend starting with Propel:
http://propelorm.org/
Once you get a bit more comfortable with that, you might want to try using a PHP framework, like Symfony, to help you structure the project in a more uniform way. However, there are many other PHP frameworks out there, so try to evaluate the top ones before settling on a favorite.
Furthermore, the examples provided in PHP framework documentations will guide you through many of the common solutions (as a framework is just a toolkit built by people who have had to solve such problems over and over).
For example, here is the cookbook for symfony that outlines many solutions to common issues.

How to use MySQL instead of XML in this example.

I was looking for tutorials on how to create " Ajax auto suggest " script for our company's phone booking system. I work for my uncle in cars re-selling company, and I really need to crate this script for my boss. I well about HTML, CSS and have average knowledge about PHP and MYSQL. I've actually create a search system but, I found this
http://www.w3schools.com/php/php_ajax_livesearch.asp
tutorial on how to create a live search. The only problem is that, they use XML, and that is complete chines to me. So, instead of using XML to store the data of our phonebooks, I would like to use mysql instead.
Is this possible at all? if so, any link/suggestion would be really nice.
thanks
Don't try to run before you can walk: first, write a simple search form which you submit and it runs some SQL to find the right results.
Once that's done, all a "live search" requires is JavaScript that quietly submits the form while you're typing and shows the top few results in an appropriate way.
You may also want to look at an auto-complete plugin, such as this one: http://jqueryui.com/autocomplete/ Again, write the code to search your database first, then adapt it to fit what the JavaScript needs.

PhoneGap & CMS integration

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.

Can Wordpress be used to create webpages that tie into pre-existing php files and database?

I have a website that I've developed, which includes hand-written php, html, css, and js. I also created the MySQL database.
I've recently brought someone on who is going to make the website look better, but his experience is limitted to working with Wordpress. I'm wondering if it makes sense for him to the the front-end "skin" work with Wordpress and for me to edit the files as needed so they submit data to my php files and connect to my database. If the php generated by Wordpress is reasonable, this seems doable in theory.
The other way would be to take the html genrated by his php and use that as my starting point for hooking into my php processing files and database.
He sent me a dump of the files created after he created a simple webpage and there seemed to be a lot of extra stuff in there.
Can anyone with experience in this comment? I'm hoping there's an easy way to do this.
Thanks.
The default procedure for me that always worked well:
You provide outlines/simple sketchups/your old layout, so the "designer" knows vaguely how you want it to be
You define what the site should do ("there should be a button to...", "there should be a list of..., when you click on it..."). So he knows what happens and what site follows another. That's important! He must understand the site.
The better you do the above, the better the results you get from the designer will be
The designer generates layouts in pure HTML with CSS: Example sites with example data, where everything you said before is integrated.
You cut up the HTML-code and integrate it yourself in your php-code
This procedure has also the benefit, that an external designer does not get in contact with your application's internal php-code (and cannot "steal" it). And you can dry up your internal code when you integrate the HTML you get.

How to create and manage a dynamic page based on user generated content

I'm trying to create a website that will take data from some file as input to a javascript page that will then do some data crunching and spit out some html. Additionally, I want the website to allow users to upload their own data to then be displayed. I'm imagining something like where the top center of the page has the results of the javascript, and below is a list of uploads and clicking on one will update the top display with new data from that upload.
I obviously don't want to reinvent the wheel and roll my own user authentication and content management system, so I was looking at drupal. Is there some way to extend drupal to do this (or a module that already does)? Or is there a better way entirely that I'm not aware of? Thanks.
I don't know if there is a framework for this, but look into jQuery templating. Other javascript libraries also offer something similar. You might also want to look into the Cappuccino framework.
It seems you have a very specific JavaScript use case. It is necessary for all these things to take place on the client (i.e. browser) side with JavaScript? Can it not be done on server side? There are thousands of modules in Drupal and some of them might be able to fully/partially meet your requirements .
I'd suggest you buy a ebook/book version of the excellent https://www.packtpub.com/drupal-6-javascript-and-jquery/book by matt butcher. After reading this book you should be able to get a fair idea of the direction you need to head in.

Categories