Skip to main content

Questions tagged [mvc]

MVC stands for Model-View-Controller. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.

Filter by
Sorted by
Tagged with
13 votes
1 answer
3k views

How can I use Joomla's Cache with my components view?

As is typically the case with a CMS, the most hits occur while it is still "new". I'd like to cache the page output the first time it is rendered for a given period as to reduce the heavy workload ...
GDP's user avatar
  • 7,715
10 votes
2 answers
4k views

Adding joomla's default toolbar in a component view page

I am developing a mvc component for both joomla 2.5 and 3.In many components i saw they added joomla's default command buttons like new, edit, publish, trash, options at top of their settings page in ...
dev-m's user avatar
  • 1,351
7 votes
2 answers
2k views

What does the view.html.php and default.php file do in the view section?

I'm sure this sounds like a silly question but I am new to the MVC framework with Joomla and I haven't found any documentation that gives a clear definition. All I know so far is that the view.html....
Isaac's user avatar
  • 71
7 votes
1 answer
259 views

Joomla! CMS Component with Joomla! Framework?

I'm curious about building CMS components on top of the Joomla! Framework mainly because I would like my components to function as standalone applications. Is this doable without hacks? If not, is ...
Nestor Ledon's user avatar
7 votes
1 answer
5k views

Override MVC classes in Joomla 3

Is there anyway to override MVC classes in Joomla 3? I have found this thread but it is for Joomla 2.5. How to override core classes? I have done MVC overrides in Joomla 2.5 successfully but now I ...
cha's user avatar
  • 387
7 votes
1 answer
508 views

How can I use the MVC Model to Load, Change, then Save a record?

After googling,etc. I've arrived at the below code to Add a new Category to Joomla so that all the plugin events, etc. get done. $basePath = JPATH_ADMINISTRATOR.'/components/com_categories'; ...
GDP's user avatar
  • 7,715
6 votes
5 answers
1k views

Where to use JInput in MVC

I'm curious as to where to get data from JInput in the MVC design pattern. For example, in a situation where I need a JInput value to use in a query in a model class method, should I get the JInput ...
doovers's user avatar
  • 509
6 votes
2 answers
6k views

What's the purpose of $this->get('Item') in Joomla view.html.php example file?

I refer to the code below, presented in Developing a MVC Component - Front End Function Example: class HelloWorldViewUpdHelloWorld extends JView { // Overwriting JView display method function ...
user avatar
6 votes
2 answers
150 views

Joomla Component Development: Starting Point

So, basically, I've developed an application that gets the data from the database, processes it and then displays it on a webpage and now I need to integrate it with joomla. I've read about MVC ...
Arter Cadelanne's user avatar
5 votes
2 answers
3k views

How can I can get the new record ID after saving data with JModel?

We need to create a new usergroup for the installation of our component, and the below code saves the data just as expected. However, retrieving the ID of the Usergroup for later use "isn't working". ...
GDP's user avatar
  • 7,715
5 votes
1 answer
4k views

Click on custom button opens modal window

I've got some custom buttons in my Joomla component and I want them to open in a modal window like with the batch button in the com_content component. Anyone has got any idea on how to do it? Thank ...
republicca's user avatar
5 votes
1 answer
1k views

Joomla Terminology: view, layout, task and component development

I'm a developer and I am very confident with MVC patterns and have already developed a lot of web apps from scratch using PHP frameworks like symfony and yii. However, I'm a little bit confused about ...
user2548436's user avatar
5 votes
2 answers
3k views

How to show and save a form from module like we do in components?

I do display and save forms in Joomla MVC components using jmodeladmin classes. But how can I do same thing from a module? As modules don't do things in the MVC way that automatically can find the ...
dev-m's user avatar
  • 1,351
5 votes
1 answer
553 views

Why does Joomla have both models and tables?

In classic MVC, you have models that loosely corresponds to the underlying database tables. Why would Joomla need both models and tables? Edit Some quotes from provided links: In summary, the model ...
Olle Härstedt's user avatar
5 votes
2 answers
2k views

Joomla MVC Component File upload w/ Database field update

So I find this a little weird because the DB field was updating without much effort on my part, until I started writing in file upload functionality. Now the database doesn't seem to be updating, but ...
dustin's user avatar
  • 107
4 votes
3 answers
3k views

Multiple controllers in Joomla

I am totally Joomla noob and trying to figure out how to control MVC in Joomla. I've read this "Developing a MVC Component" in Joomla basic tutorial and understand that the main controller is ...
SonDang's user avatar
  • 163
3 votes
2 answers
5k views

Calling model's method from view works, but not from controller

I am trying to call model's method from controller. controller.php if($view='myview'){ $model= $this->getModel('mymodel'); //on echo-prints class name of model $locations= $...
user1926's user avatar
3 votes
2 answers
775 views

Joomla AJAX request

I'm developing a Joomla component where I have a treeview in the sidebar with the content of a database table. When clicking a node of this sidebar I want to show the children nodes in the main part ...
republicca's user avatar
3 votes
2 answers
2k views

Pre-processing form data before display / save - what's the standard approach?

I'm developing a new Joomla component where I have a JAdminForm called course.xml. This form has several text fields / text areas that will contain meta titles / tags for an item. However, when ...
codinghands's user avatar
  • 2,295
3 votes
2 answers
703 views

How to query and display a list of nested tags for a particular parent on front end as links?

What is the best way of querying the db to generate a list of tags matching a particular parent and display on the front end as a link with tag title and id? This is for a custom joomla mvc ...
user2097091's user avatar
3 votes
1 answer
681 views

MVC component JForm data array to string conversion before save()

I have an admin form with a multiselect form field. Hitting save is passing this as an array and I would like to convert these array values to a comma delimited string before saving to the database. ...
dustin's user avatar
  • 107
3 votes
3 answers
1k views

Edit a record saves a new record with updated fields

I'm writing a small Joomla component for my school but there is a little problem with it. When I go to edit a record and then save it, instead of updating that record, it saves it as a new record ...
Sumer Raj Chouhan's user avatar
3 votes
2 answers
495 views

How to programmatically set 'created_by' when creating a new category

While writing an import script, I need to create categories for the data, and am successfully accomplishing that with the below code. However, I can't determine how set the created_user_id column of ...
GDP's user avatar
  • 7,715
3 votes
1 answer
1k views

Joomla 3.4 Development File Handling

I am making a basic MVC component, mostly following the HelloWorld tutorial. I made a form which contains a upload button and an input of type "file". The form loads fine, but when I upload a file I ...
user avatar
3 votes
1 answer
492 views

How can I use PHP to filter a list as though they had clicked on a Search Tool list item

Based on some internal conditions, I need to filter a list and have the "Search Tools" engaged showing the selected item in the filter list. The net effect that we want is the same as appending the ...
GDP's user avatar
  • 7,715
2 votes
2 answers
3k views

How to render a component view in a module?

Brief I have a component and have a form in it. And I want to render the same form in a module. An example can be core Joomla article edit form components/com_content/views/form/tmpl/edit.php which ...
AHeavyObject's user avatar
2 votes
2 answers
403 views

How about storing single records and their categories in one table

I'm developing my own component for Joomla. I know that in many components single records and their categories are stored in different tables of the database. But how about storing them in ONE table ...
stckvrw's user avatar
  • 891
2 votes
1 answer
1k views

Model / View pulling data from external API(s)

I have a model pulling data from two external API's, concatenating the returned arrays, and a view template that displays it. I have a sub-view that will need only one of the API's. So my question ...
James's user avatar
  • 652
2 votes
2 answers
173 views

MVC: Include classes in a component

So, for example, I have 3 classes: Division, Employee, Task. Every task has an employee assigned to it and every employee belongs to a division. Currently I need 4 views: a list of tasks assigned to ...
Arter Cadelanne's user avatar
2 votes
1 answer
172 views

The safety of direct SQL-requests in Joomla templates/views

I need to change the ordering of which the products are displayed on the Virtuemart category page. The files models/product.php and tables/products.php are too complicated for me to put the changes in ...
stckvrw's user avatar
  • 891
2 votes
1 answer
956 views

Refreshing a part of the page after Dropdown list selection

How can I refresh a part of the page when I select from a dropdown list using the onchange in HTML? I have a Reports dropdown list. Once I select a Report, a list refreshes only displaying those that ...
Break the Law's user avatar
2 votes
1 answer
627 views

Documentation tutorial: Why is my JFormFieldList showing a textbox?

I was going through this part of the tutorial: https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Using_the_database Except I tried using my own names instead of 'helloworld'. Everything else ...
Glitch's user avatar
  • 297
2 votes
2 answers
571 views

JModelList Group by Category

I have a Component with the following table: +------------------+------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default ...
user avatar
2 votes
1 answer
245 views

Sharing a model between two views in a component

I have one model I'd like to use for two different views. This is the only model these two views will require. I'm subclassing Joomla\CMS\MVC\Controller\BaseController and I'd like to use its display ...
Dom's user avatar
  • 512
2 votes
1 answer
264 views

Where to prevent field value change in custom component form record?

Where is the best place in Joomla MVC (server-side) to forbid users from changing a value in a pre-existing form record? In JTable check / bind/ JModel prepareTable, or elsewhere? For context, I have ...
codinghands's user avatar
  • 2,295
2 votes
1 answer
1k views

How to call Users controller's method from any custom component with argument?

Can any one suggest how I can call the Users default controller's methods, like activate or any other, that I have created in User controller of Admin site with argument?
Rushabh Madhu's user avatar
2 votes
1 answer
84 views

Where to process data in MVC

This may be a very basic question but i am new to this and all the tutorials i watched don't work with processing data before displaying. I am working on a Administration Component thet is supposed to ...
LocalHorst's user avatar
2 votes
2 answers
4k views

Calling model from view error: Fatal error: Call to undefined function

I am just starting with Joomla component development and MVC in general. Im also not incredibly strong in PHP but I am trying to build a component that gets json and displays it as a jQuery accordion ...
John's user avatar
  • 33
2 votes
1 answer
207 views

How can I create a custom attribute/property on a model?

In my custom component, I'm currently stuck with Joomla's way of handling model custom properties. Let's say I have a model Property. To know if this Property is sold, I have to run a query on ...
thomas_inckx's user avatar
2 votes
2 answers
143 views

Natively override core extension classes from templates?

Is there any way to do this natively yet (ie. without using a plugin)? I'm hoping there's native support similar to the way the old MVC Override plugin allowed class overrides using a /code folder in ...
Bathmat's user avatar
  • 502
2 votes
1 answer
307 views

How to use look-up tables in a custom component?

I'm trying to develop my first component in Joomla 3.x. I'm new to the MVC paradigm and learning the basics of Joomla development. To start, I'm trying to develop a simple component to add and ...
nimble's user avatar
  • 418
2 votes
2 answers
1k views

Fatal error: Cannot redeclare class ContentModelArticles

I tried to edit some of the core files in Joomla. Im using MVC override plugin:enter link description here I want to override article.php and articles.php in components/com_content/models. The ...
Peter's user avatar
  • 325
2 votes
1 answer
1k views

Joomla 3: display view with toolbar in modal

I'm developing an MVC component for Joomla 3.x with currently 3 views: VIEWS |-PAGES (displays all pages in a list, ordinary joomla view) |-view.html.php |-TMPL |-default.php |-PAGE (forms ...
BracketBulldog's user avatar
2 votes
0 answers
176 views

How to get an AJAX call in component's administrator side

I added a component to my site and it accesses my DB via an AJAX call. In my 'tmpl' folder, I have a 'default.php' file which makes an AJAX call that is received by view.json.php just outside that ...
LaioZatt's user avatar
2 votes
1 answer
313 views

Create record from modal edit form

Is there a standard Joomla mechanism / development pattern for creating a modal edit form to create an item from within another item? I've used this tutorial to create a modal list view, where you ...
codinghands's user avatar
  • 2,295
1 vote
2 answers
64 views

For how long will legacy component MVC structure work in Joomla?

Legacy component MVC structure: com_foo |- controllers | |- foo.php |- helpers | |- foo.php |- models | |- forms | | |- foo.xml | |- foo.php |- views | |- foo | | |- tmpl | | | |- default....
mavrosxristoforos's user avatar
1 vote
1 answer
641 views

Joomla correct way of routing

This is in my Controller. Currently, I am redirecting using the inherited function setRedirect(URL_TO_REDIRECT_TO). public function redirectTo($layout){ $this->setRedirect('index.php?option=...
DeesreX's user avatar
  • 87
1 vote
1 answer
120 views

Toolbar not displayed in my Joomla MVC component

view.html.php class gezcViewVliegtuigen extends JViewLegacy { protected $editID = 0; // if task is not specifiek in the url als parameter, display will be used function display($tpl = ...
user3412673's user avatar
1 vote
2 answers
108 views

Joomla 4 API MVC Layer type

Is it possible to create a webservice and API access for my own component if the component file structure is not setup like this and uses namespace based classes? https://docs.joomla.org/J4.x:...
maidan's user avatar
  • 443
1 vote
1 answer
367 views

View only showing one row from sql result set

I am creating a component and trying to display a list within a model. The code I have shows the multiple arrays that should be on the list, but when I add echo inside the view table, I am only ...
Brandon's user avatar
  • 69