How to update the content of a website using the website itself? - php

Is it possible to update the content of a website (add Item, remove Item, update Infos, etc...) directly from the webpage?
For example, you have a webpage and you make a new page in it, that only the admin can access. That page should contain some options that allow the admin to change/update contents on the actual website(what people can see) easily.
(Without the admin having to write new HTML or PHP code...)
I heard something about Joomla or Wordpress but I don't really know how they work.
Thank you.

Basicaly, joomla has some fonctionnalities to edit content by the frontoffice. Of course, the user need to be logged and access levels need to be well managed. You should to try it with a basic installation and see if it's coherent with respect to that you looking for.

Related

How should I build a website for someone else who wants to embed their own Youtube links?

first post here.
I am making a site for someone who wants to embed their own youtube links. I am relatively new to web development and this is my first commission so I was wondering how I could hand over the site to the client and allow them to upload their links without me having to edit the mark up for him.
I understand how to use an '<iframe' youtube link in HTML to embed videos and am considering creating a database using PHPmyadmin that uses a form that the client can fill in with the iframe link whenever he needs to embed a new video.
I understand if that sounds like a convoluted way of doing this but if anyone knows a more intuitive way to solve this issue please let me know :)
I think it can be done using a database, may be MySQL, to keep it simple and a simple backend programming language, PHP would do.
You create an admin page just to collect the URLs from the admin. A nice little login page which stores admin username and password in a table. And you can use this module to assign roles to admin, add an admin or delete one.
Inside the module created above, create a page with a form to fetch and store URLs in the database. If you are going to categorize the videos, use suitable columns. Say you are going to categorize based on the genre and length, the table in your database should contain genre and length so that you can use them as filters later on.
Use cookies to create session for the admin. This is to avoid redirecting him to the login page after every single reload.
For all other user who is not admin, do not redirect to the admin page. Redirect them to a common page where they can search and enjoy the videos that the admin has added.
Again, like mentioned in many comments above, wordpress does it all. You have an option to use it too, it's free.

Dynamically Creating pages based on user's input

I have an article website. So far, all my articles have been created by me working with the code. Copying and pasting the code and editing the P tags, H1 tags, etc. This turns out to be a hassle and increases the chance of you making an error. Especially when the article has multiple pages.
Future-wise, I want users to create articles. So this is what I want: User clicks on button that says 'create an article' and then the user gets redirected to the article builder page where they can make an article for themselves. The user will create a name for their article, this name will create a folder on my server...for example: www.example.com/articles/name-of-article. Then the user can write the article. The user will abide by classes I have created for tags, but those tags will not be seen by the user. The user only sees that their content is getting adjusted well based on my CSS template. Also, if the user wants to add another page to the article, they can put in already built buttons...they just have to change the links to those buttons. The user should also have the ability to bold, underline, and italicize text.
Note: Users are working with a pre-built template, not a blank page. The template article includes a recommended panel, showing other articles. The user does not have permission to edit this panel.
I've heard about WYSIWYG HTML editors, but I just want to know if this is the right thing for what I want. Is there something else that can accomplish my task better? If WYSIWYG is the best answer, can it do everything I've asked for?
P.S: My article pages are PHP pages, with HTML and Javascript included.
You don't need to write html codes of articels in php. I would suggest you to use a content management system (CMS) like Wordpress.
What you want is a CMS. Wordpress is the best approach for your needs, but if you can't use it, you can search for other CMS systems/frameworks.
If you want to make/use your own, just remember to do a Template framework.
And appart of your main question about WYSIWYG, yes, you can do all you asked if it can be done with PHP.

WordPress Login System (with the loop?)

I currently have a MySQL database from my old site that used to have a basic PHP log-in form and it would query a table containing the user information to log them in. Basic stuff. However I've recently moved to WordPress and it appears to be quite overwhelming at first, so I'm struggling to understand how to integrate my old log-in form with a WordPress site.
I have tried looking at this post:
Wordpress login system and I am still confused. I understand the 'loop' is responsible for displaying multiple 'Posts' on a single page. But to integrate my own PHP code or more specifically; a log-in page, would I make a logged-in 'Post' and a not-logged-in 'Post', and perhaps use a template to display one or the other for a single page via a 'Loop' that uses an if statement to check if the user is logged in?
Or is there some easier method that I'm completely missing?
Thanks!
EDIT: I've thought about creating two pages, both using a template to check if the user is logged in at the top, and display relevant content if they are, or redirect to the log-in page if they aren't. Would this work?
The other possible method I could think of is creating two Posts and displaying the relevant one on a single Page via The Loop. Would this be possible? Are there any security concerns?
EDIT2: I'm going to try the Members plugin and see if I can modify the WordPress MySQL tables to allow room for my previous data.
EDIT3: I need to sync my user logins to our external database as it contains flags to check whether my members are able to access our 'support' pages. I'm not sure how this would be viable while relying on the normal WordPress login system and tables.
Keep it simple stupid.
The point of WordPress is to make things easier. So if you want to go with WP, you should adopt the WP way of doing things.
As comments has suggested, import your current user table into WP. Should be simple enough to change the columns around to get a working import directly into the WP users table.
If there is extra information in your current user table, simple create new fields in the User Profile section of WP. There should be plugins for this (although I have not tried any), but it is quite simple to add these fields yourself, just google for it, there are many tutorials.
For a frontend page to be accessed by only logged in users, simple create a page template and check if user is logged in with is_user_logged_in().
For the access part (Support Pages), either create different user roles and check that the currently logged in user is of the correct role. Or you could also add a custom user capability and validate it on your support pages.
Based on the very general details you have given there is no 'easier method' you are missing. We can't help you form the requirements of your application, but we can help with code if you paste examples of the code you are using, what you are trying to achieve, and what is going wrong with it. Pick one thing, try it out, and if it doesn't work and you get stuck then post it here.

Quickpost form on Drupal front page

Hey, I'm quite new to Drupal and am having some issues with implementing a node form on the front page of the site.
I want to have a really simple quick post form on the users front page when they are logged in, just a few fields and a submit button, no advanced options or anything.
Is there a really simple way to do this by placing some php in the front-page.tpl.php file?
I think what you are looking for is http://drupal.org/project/webformblock. (also requires the webform module)
Create a region on the front page and just put this block in it. You can set options in the block to only appear on the front page.
Or you could just invoke the block directly in the tpl.php file.
http://drupal.org/node/26502
Yes and no. This is not the drupal way of doing things- although you COULD make it work this way.
If you are looking for a simple solution, try a module like webform and put it on the front page. You can do this by either creating a page and setting it as the front page (under site information in the admin menu), or by creating a block, putting it in the 'content top' region of your theme, and in the configure block setting it only to display on (a special keyword that means frontpage).
Hope this helps!
Chris.
If your login goes to the /user page you can use the webformblock module (http://drupal.org/project/webformblock) to configure a Webform to only show up on the "user" page under site building > blocks > configure (next the the webform block). You can also check the option there to only show the block for authenticated users or another role of your choice.
You do not want to create a form without going through Drupal's form API, as you lose a lot of security features and there are many tools out there already that make it easy to generate and maintain forms through the Drupal interface. As the above answers suggest, webform is the Drupal way to create quick forms. And I think you will love the interface.
http://drupal.org/project/webform
Thanks for all your help guys. I tried the webformblock module and whilst it did fit the bill, it required me to create a new content type (maybe I wasn't using it right?).
In the end, after searching I found the Form Block module http://drupal.org/project/formblock which fitted my needs perfectly. It can be configured for existing content types really easily.

Wordpress: using a test theme only for a specific user

I'm testing a new template for a wordpress based site, and I'd like to test it directly on the live version instead of making copies. I thought I could create a test user (wordpress is bridged with vbulletin which handles user auth), serve the usual theme to anyone BUT that specific user, who would get the new testing one.
I don't want to install a plugin, I'm looking for the right place to edit to insert this check:
if logged user == test_user_id
serve 'testtheme'
else
serve 'normaltheme'
The userid can be get from $_COOKIE.
I tried hacking the get_template() function in wp-include/theme.php but apparently that was not enough. Any suggestion?
This is the best way to "test" or develop a theme behind the scenes without needing to alter too much of your Wordpress core or make custom changes...
http://digwp.com/2009/12/develop-themes-behind-the-scenes/
Just logging into my old Wordpress.com blog, I see that I can do all the previewing I want from the themes manager already - click around to any page I like, or bring up the frame's URL to see what query string I'd have to append to a URL to get the same preview, e.g.
?preview=1&template=pub/mytheme&stylesheet=pub/mytheme
Any reason that's not enough?
Perhaps you should add a column to your user table, call it "is_beta" and if it's set to 1 then enable beta features/themes. This way you can easily add or remove people from the beta, and when you're beta is ready to launch, you flush the column for everybody and make the features default.

Categories