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
2
votes
2answers
65 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 ...
3
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
1answer
119 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
1answer
71 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
38 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
30 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
36 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
74 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
56 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 ...
0
votes
0answers
15 views

“Error” when developing an MVC Component In Joomla

I'm getting an error when trying to create an MVC Component, as shows here: https://docs.joomla.org/Special:MyLanguage/J3.2:Developing_an_MVC_Component/Adding_a_front-end_form But the problem is ...
1
vote
2answers
102 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 ...
4
votes
2answers
575 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 ...
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 ...
2
votes
1answer
92 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 ...
0
votes
2answers
560 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 ...
6
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 ...
5
votes
2answers
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". ...
1
vote
0answers
535 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 ...
2
votes
2answers
113 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
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 ...
0
votes
1answer
511 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
446 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
480 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="...
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 ...
5
votes
1answer
434 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 ...
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/...
6
votes
1answer
872 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 ...
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 ...
0
votes
1answer
158 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
1answer
236 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
294 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 ...
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 ...
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)...
2
votes
2answers
976 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 ...
1
vote
1answer
119 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
264 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 ...
2
votes
1answer
929 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
165 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 ...
2
votes
1answer
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 ...
2
votes
1answer
158 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 ...
6
votes
2answers
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 ...
5
votes
2answers
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 ...
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 ...
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....
6
votes
5answers
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 ...
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 ...
4
votes
2answers
613 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 ...
1
vote
3answers
250 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 ...
2
votes
2answers
517 views

JModelList Group by Category

I have a Component with the following table: +------------------+------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default ...