phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Joomla - MVC: Controlling Publish State for Back-End

Tag: joomla, MVC, pattern, component, back-end   Category: PHP Framework
post: 07 Feb 2008 read: 1,203


Joomla Back End MVC Step by Step Tutorial - Part 10: After create delete function at back end, now, we add a function for controlling publish and unpublish state.

Open "controller.php", add following code:

joomla mvc back end controlling publish


  function publish()
  {
  	global $option;
	
	$cid = JRequest::getVar ('cid', array(), '', 'array');
	if($this->_task == 'publish')
	{
	  $publish = 1;
	}
	else
	{
	  $publish = 0;	
	}
	
	$helloTable =& JTable::getInstance('hello', 'Table');
	$helloTable->publish($cid, $publish);
	$this->setRedirect( 'index.php?option=' .$option );
	
  }


Series this article:
Joomla - MVC: Reorganizing Back End Code
Joomla - MVC: Creating Controller and Model for Back End
Joomla - MVC: Creating View for Back End
Joomla - MVC: Adding Pagination for Back End
Joomla - MVC: Adding Element Paginating for Back End
Joomla - MVC: Creating Form Input Data for Back-End
Joomla - MVC: Saving Data for Back End
Joomla - MVC: Editing Data for Back-End
Joomla - MVC: Adding Delete Function at Back-End
Joomla - MVC: Controlling Publish State for Back-End

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


619
posting