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
1answer
72 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 ...
0
votes
0answers
39 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/...
1
vote
1answer
32 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
0answers
55 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 ...
2
votes
0answers
36 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
1answer
103 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
1answer
67 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
2answers
84 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 ...
0
votes
1answer
155 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
2answers
105 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 ...
2
votes
1answer
105 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 ...
1
vote
0answers
540 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 ...
0
votes
1answer
534 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
1answer
466 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 ...
1
vote
1answer
512 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="...
2
votes
1answer
159 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
1answer
54 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/...
5
votes
1answer
902 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
1answer
451 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
1answer
168 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
2answers
118 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 ...
2
votes
1answer
238 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 ...
0
votes
1answer
300 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 ...
2
votes
1answer
259 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 ...
1
vote
2answers
2k 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
1answer
123 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
vote
1answer
63 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)...
1
vote
1answer
129 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 ...
2
votes
1answer
274 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 ...
1
vote
2answers
579 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
1answer
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 ...
2
votes
1answer
161 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 ...
2
votes
2answers
167 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
2answers
137 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
1answer
962 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
2answers
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 ...
6
votes
2answers
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....
2
votes
1answer
79 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
1answer
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
2answers
633 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
1answer
68 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 ...
4
votes
3answers
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 ...
3
votes
1answer
658 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. ...
1
vote
3answers
251 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 ...
1
vote
0answers
97 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
votes
2answers
368 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 ...
1
vote
1answer
79 views

Where to add M-N linking records after a another record is saved?

In my component, I have 3 tables, 2 object tables (Course and Module), and 1 linking table (Course_Modules). In my edit form for courses I have a multi-select allowing users to pick 1 or more modules ...
1
vote
1answer
103 views

How can I include additional models in a subcontroller?

So I have a subcontroller extending JControllerForm that handles the edit view of an item in my component. As part of this I'd like to render some associated items, which come from a different DB ...
3
votes
2answers
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 ...
3
votes
3answers
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 ...