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
1 vote
1 answer
41 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=...
  • 43
1 vote
1 answer
39 views

I want to display a form with the data added already

public function getLaymanLayout($id){ $form = $this->getForm(); $form->bind(0); } I still have a lot to implement and make it correct to the MVC rules. I want to call a table from the ...
  • 43
1 vote
0 answers
18 views

Getting allready created component model instance in a module (singleton)

I have a module, that does some stuff and needs the data from the list model of my component. Everything is coded in MVC pattern using the Joomla framework. When clicking on a menu item the list model ...
  • 153
1 vote
1 answer
94 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 ...
  • 69
1 vote
1 answer
91 views

Sharing a MVC resources library between two components

Lets say my component is called dumbo. It contains all kind of MVC stuff and works well. Now i have a second component that is called jumbo. I need both components to share some models, controllers ...
  • 341
0 votes
0 answers
45 views

Can I load my controller, model and view directly from the plugin?

I am trying to create a plugin that adds a new view to my component (addon). Can I load my controller, model and view directly from the plugin? For example: require_once("/pludins/myplugintype/...
  • 111
1 vote
1 answer
60 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 = ...
1 vote
0 answers
120 views

Embed custom JS app in Joomla MVC

A before warning: I'm new to both Joomla, PHP and JS. So this might be obvious, but I'm lost. I'm looking to embed a program I made in react/node into Joomla. The program uses JSX to create the HTML ...
  • 11
2 votes
0 answers
99 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 ...
0 votes
1 answer
250 views

Display the component view or layout into a module

I've built my own component com_mycomp and in the component there is form in a layout and the path to this layout is: com_mycomp/site/layouts/subscription/form.php so I want to show this layout (form)...
0 votes
1 answer
152 views

Create a User Area

I'm wondering how i can create a User Area for users to login and gain access to a user panel (where user can update their info and specfic/custom actions). Because the Joomla user login ...
1 vote
2 answers
188 views

How can I show an alternate layout for my view in an MVC component?

I am trying to choose the layout for my view dynamically, which is what I imagined setLayout or loadTemplate on my JViewLegacy view would be able to do, but there seems to be some extra convention ...
  • 239
0 votes
1 answer
293 views

Retrieve the value of a line a checkbox

I'm blocking on retrieving an item from a data list. My code: <div id="contenu2" class="content"> <div> <form action="" method="post" id="adminForm" name="adminForm"> <table ...
1 vote
2 answers
324 views

How to set the view location in Joomla 4

I'm rebuilding a component called DogWalk for Joomla 4 and I've tried to ensure I'm doing exactly what the core Banners component does. I've named and namespaced my files, named my directories ...
  • 1,089
2 votes
1 answer
172 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 ...
  • 492
1 vote
0 answers
559 views

JModelAdmin - save() method. What's the purpose of $table->newTags?

Can someone explain me why in the save method of the AdminModel class, there is the creation of a new $newTags property on the $table? How this new property is used? How is it handled later on by the ...
  • 19.5k
0 votes
1 answer
640 views

Calling a Model's Method from View [duplicate]

I have a function in my model to sum several columns of a table. public static function get_sums() { // Create a new query object. $db = $this->getDbo(); $query = $...
2 votes
1 answer
540 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 ...
  • 287
1 vote
1 answer
590 views

Get user id from user form field type

I have a custom database table created with my component that has a user id linked by foreign key to #__usersand I have a form field type in Joomla 3.x mvc <field name="modified_user_id" type="...
  • 113
2 votes
1 answer
180 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 ...
1 vote
1 answer
59 views

joomla mvc tutorial editing component issue

I have gone through the steps provided here: https://docs.joomla.org/J3.x:Developing_an_MVC_Component I am currently on https://docs.joomla.org/J3.x:Developing_an_MVC_Component/...
  • 48
5 votes
1 answer
986 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 ...
5 votes
1 answer
515 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 ...
0 votes
1 answer
211 views

Restricted direct access creates problems passing references between files

Context (Long Story Short): I am using a PHP script and the $_POST variable to handle certain ajax POST requests from a view template. It needs access to database connector classes which can be ...
2 votes
2 answers
138 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 ...
  • 492
2 votes
1 answer
259 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 ...
  • 2,295
0 votes
1 answer
321 views

Can a model display itself within the view of a different model?

This isn't a question about getting model data into another view. I can create a huge form with data from multiple models. But, is that necessary? Can a model display its view within the context of ...
  • 418
2 votes
1 answer
276 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 ...
  • 2,295
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 ...
0 votes
1 answer
132 views

Joomla component development - how to organize?

I am trying to write simple component for Joomla 3 to show catalogue and products. I did made my model catalogue and it works ok - it shows list of all products with pagination, but I also want to ...
  • 1
1 vote
1 answer
72 views

What is the proper way to handle models that use other models in MVC?

I'm developing my first component and I'm not sure how to best handle models that use other models from a design and implementation standpoint. For instance, I have a contact model (person or business)...
  • 418
1 vote
1 answer
152 views

which exception should be thrown when sanity checks fail?

Which SPL exception should be thrown when sanity checks fail? For example, if the check() function fails when saving data with JTable or a parameter check fails? I'd prefer to use something more ...
  • 418
2 votes
1 answer
287 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 ...
  • 418
1 vote
2 answers
673 views

how to rename file on upload custom component joomla 3

I recently create a custom component with Component Creator, and I have a form in admin area that uploads file... But I can't upload files with same name it's going to replace the previous file, now ...
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 ...
  • 461
2 votes
1 answer
166 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 ...
  • 891
2 votes
2 answers
172 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 ...
6 votes
2 answers
144 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 ...
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?
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 ...
  • 325
7 votes
2 answers
1k 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....
  • 71
2 votes
1 answer
81 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 ...
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 ...
3 votes
2 answers
702 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 ...
0 votes
1 answer
73 views

The best way of storing products and categories in own component

I'm creating my own shopping cart component and I can't choose what way of storing products and categories would be the best. There are the following few options: 1. A fully independent component ...
  • 891
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 ...
  • 163
3 votes
1 answer
669 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. ...
  • 107
1 vote
3 answers
259 views

MVC component language file not overriding '_N_ITEMS_DELETED' string

I have a feeling this has an extremely simple solution that I am overlooking... My component has a language file which does some string replacements (surprise, surprise). Most seem to be working, but ...
  • 107
1 vote
0 answers
102 views

How to retain state on refresh when adding a new item?

In a component I'm building I plan on having a 'new item' screen featuring a button that will, on click, allow a modal selection from a 'list' view using a custom modal form field type. Once done, I'...
  • 2,295
2 votes
2 answers
379 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 ...
  • 891