I'm developing a component (backend). I got a listview with a $_GET that contains a ID number
and i want to send the $_GET to the add view
(JToolBarHelper::addNew('item.add', 'JTOOLBAR_NEW');)
But i don't find any good solution on this, i have inserted the value in listviews form, but i am not possible to take it out. I tried to create a add function in the controller for my add/edit view but is dosen't work. Hope someone can help me out.
You might consider JApplication/JSession like this
Related
I am having some trouble accessing x-model data in my laravel app and storing it into my database. Wondering if anyone can help.
So the issue seems to be coming from the fact that I have the category select as a separate blade that I call multiple times.
So ultimately, this code is called three times on my main page. I can then choose three separate categories - but when I try to call those selections and store them in database I run into an error.
Wondering if anyone has any ideas how to access the three separate categories being selected and add them to database. Some links or documentation to check out would be mighty helpful!
Using alpinejs, php, and laravel.
EDIT
In this particular case I am passing the information into the blade through the controller.
EDIT 2:this shows $selection_id
x-model takes the name of a variable inside x-data, not the value.
$selection_id here is a value.
You should do something like:
x-data="{ selection_id: {{$selection_id}} }"
on the component element
then inside x-model:
x-model="selection_id"
Note: Your code is missing, please add the part with the `x-data showing.
Apologies again, as I'm new to PHP so not fully sure how this works, but thought I'd ask.
I have a page called contract.php, which I'm hoping to use as a template so that when someone selects the contract they wish to view it goes to the contract.php and loads the content for that particular contract.
Hopefully I shouldn't need to create a page for every single contract, I was hoping that I could use the contract ID, so that when the navigate to the page it would show something like contracts.php?contractid=555 and then loads the contracts details for contractid 555, so this does this for each new contract that's listed.
The issue I'm having is, I'm not sure how best to go about it, or how to use this ?contractid='xxx' etc.
Any help would be appreciated.
Many thanks
$_GET manual.
after reading the contract id from the get variable, you can search your DB for that contract and echo the specific data of this contract.
Also consider using $_POST so that you can't easily see any contract by changing the url by yourself
You can fetch respective data from your database for each contract using the contract ID. Inside the contracts.php, check whether contractid variable is set and not empty, using isset($_GET['contractid']) && !empty($_GET['contractid']). If it is true, then fetch respective data from the DB and display it to the user, in the template that you must have created.
Hope this helps. If you need more help then paste your code here.
I've been basically following the joomla guide for a front end form, but I'm having trouble understanding how to keep my form view once submitted. I'm getting data back, but it's from my controller and just replaces the form. This isn't a DB update, it's pulling data from an API that should be shown below the form... but I don't see how to do that based on the guide.
Sorry, I feel like this is a dumb question, I'm just not used to MVC yet. Maybe someone can point out a better guide for this?
Nevermind, I figured out a way around it. I'm using JQuery to get the results in a div.
I'm trying to figure out how to let the user add any numbers of tables or CGridview on a single page. So right now the page has two gridviews in it which will stay fixed. Now i want to add an add button somwhere, clicking on which will give the user another gridview, and so on.
How should i proceed with this. I mean is there an easy way to do this, without resorting to writing everything from scratch.
What i was thinking was to create a new view file using file_put_contents() or fwrite() dynamically everytime the user wants another table on the page? Now following in my line of thinking from where would i create these dynamically view files.
Should i write the whole code of the view and put it in a string, in the controller, and call file_put_contents() from there.
This would cause another problem as the filter needs a specific ajaxUpdate url like this
'ajaxUrl' => Yii::app()->createUrl('project/AjaxUpdate'),
.
Which would entail i would have also have to dynamically create the actionCode in the project controller for the filter in that dynamic grid to work. eg. project/AjaxUpdateDynamic1, project/AjaxUpdateDynamic2, etc.
So i'm kinda stuck with this problem. I would really appreciate if someone points me in the right direction.
Thanks, in advance,
Maxx
if you had an action for ajax loading your gridviews, you can then set your ajax url to that url and you'd have filtering possible for your model, you can even put multiple gridviews for multiple data providers that can be loaded via a parameter that you have sent along with click of your button and an input.
Hi I'm trying to use the CakePHP comments plugin found here http://cakedc.com/downloads/view/cakephp_comments_plugin but the instructions are really hard to follow. I've managed to add comments but it's displaying the commentWidget that's not working.
I'm getting confused at this part i think
To work properly, the component needs
a specific variable to be set in every
action using it. Its name should be
either
Inflector::variable(Controller::$modelClass)
or Comments::$viewVariable should be
set to other name of this view
variable. That variable should contain
single model record. for example you
need to have next line in you view
So far I've created the comments table, added it to the pluging and components arrays and added the following code to the controller:
public function beforeFilter() {
parent::beforeFilter();
$this->passedArgs['comment_view_type'] = 'flat';
}
I added the route
Router::connectNamed(array('comment', 'comment_view', 'comment_action));
And also the Comments.CommentWidget as a helper in my controller.
I'm just wondering if anyone has used this plugin before and can help me out?
thanks,
Jonesy
You're right - the documentation is really confusingly worded. However, if I understand correctly, what it wants is a copy of the record of the piece of data the comment will be attached to passed to the view the comments will render on.
So say you're making an event page, and you want people to comment on the event. You need to send to the view a variable called "event" with a copy of the base data for that event.
From their example they show: $this->set('post', $this->Post->read(null, $id));
For your event, you'd do something like $this->set('event', $this->Event->read(null, $id_of_event));
The Comment view probably needs this data for hidden fields so it can populate it with the model name and the event id.