I am trying to make a Joomla website, where entries from the SQL database would be shown depending of different queries. I would like to write a universal module, which could read in some parameters (as a normal function would do), then do a database search and display the results. I cannot find a way to do this. I can only hardcode some rules inside the module but there is no access to the module from the Joomla administrator panel. Thanks in advance.
I'm guessing here that you're tyring to build something similar to an AJAX search module, given that there are lots of these on the Joomla Extensions Directory, I would recommend looking at several of these modules to see how they did it.
Depending on your specific version of Joomla and the way you implement it you may be able to use the AJAX Interface in 3.2+ versions of Joomla
Are the URL parameters you need available on initial page load? If so, you can simply use the JApplication input object to retrieve cleansed GET/POST parameters.
$jinput = JFactory::getApplication()->input;
$myVar = $jinput->get('myVar', 'default my var value if not avail');
You could then capture the needed parameters to build out your DB query.
If the parameters are not available and the data needs to be acquired through an AJAX call, you could use cppl's solution or roll your own using this tutorial.
http://docs.joomla.org/JSON_Responses_with_JResponseJson
Related
I have a web app running on Bolt CMS and I need to be able to save some information across page loads so it's persistent. The data needs to be set via an AJAX call and retrieved within a Twig template. The trouble is, I don't know how I can do this within the Bolt environment (I've never used Symfony before)
I've seen quite a few similar questions on how to retrieve session variables within a Symfony controller but nothing on how to edit (or add a new) controller so that I can call it via AJAX to set the session variable
Thanks
Because twig is rendered server-side, I assume you want to set something in one request, and then fetch it again on the next. I think you will need to create an extension for this, that stores the data in a table, and allows you to fetch it later. Take a look at the "WaffleOrders" extension for a good example on how to do this: https://github.com/bolt/WaffleOrders
This is all happening on the bolt side, though. To make it ajaxy, you should use jquery's ajax functionality to POST or GET the data, as needed.
hi I have following problem. Standard actions on components are in Joomla called like this index.php?option=com_name&action=MYACTION. Then I can use Joomla framework in my component e.g for database access.
I am developing component for 3dsecure gateway. In one step of the payment i need validate data sent from bank. So I need something like this index.php?option=com_name&action=validate. But the bank adds after this URL another ? and more parameters, so I think it can't be working..So I want to access my Joomla component for example from 3dsecure.mysite.com/validate.php?Is it possible?
I simply want to use JFactory::getDB and then e.g redirect to any view. I know I can use mysql_connect and create own connection to DB, but it is very ugly:)
Can I somehow redirect the request on my side (create valid url with parameters sent from bank) ?header(Location:)??
Thank you for your help
You can't use Joomla!'s apis outside the framework, unless you provide there al the need dependencies (thus recreating the framework elsewhere), which is pretty nonsense.
Moreover, you can have has many parameters as you want in a component url, it's up to the component router to know what to do about that... So, in you router class of the component, you'll place handlers for every $_GET paramater you need, like those returned from the bank.
If you just don't want to get dirty with mysql_* stuff, use PDO (which is, btw, a better approach in general).
Consider using a rewrite rule on the server.
For example, rewrite
3dsecure.mysite.com/validate.php(...)
into
index.php?option=com_name&action=MYACTION(...)
If you are using Apache, you can use mod_rewrite for this purpose.
With simple queries I'm able to produce pages with nice pagination links. However, if the query is generated through some sort of search filter, I'm not sure how to pass the $_POST data from page to page.
Usually I can do this ... www.domain.com/search.php?id=200&type=host&rack=3&os=redhat%5
However, with CI's URI library, I'm using "pretty urls," hence my URL is more like www.domain.com/search/page/1 Appending the rest of the variables doesn't make sense nor will I think it will work. Any ideas on how to tackle this issue?
Why don't you just store the variables you need in a user session? Here is some information about how to use a session to store information about a user with codeigniter:
http://codeigniter.com/user_guide/libraries/sessions.html
Format your URI like so:
index.php/controller/method/id/200/type/host/rack/3/os=redhat%5/page/2
You can then use $this->uri->uri_to_assoc(n) to turn that URI into key-value pairs. See:
http://codeigniter.com/user_guide/libraries/uri.html
Please have a look the link below. This article show you have to pass parameters on pagination without turn on enable query string settings.
http://pujanpiya.com.np/?q=node/37
Hope this help!
If your using the built in pagination class, just make a separate search method on your controller and provide it with the pagination info...
FYI, there is a great jQuery Plugin that takes care of alot of table related work for you. Datatables.net
I just wrote a library that handles search, pagination, sorting and limiting.. Check it out here.
http://datatables.dyndns-web.com/
Is there a way, to (automatically) generate, or "duplicate", the site tree for a translation into another language? For example via an url command or something like that.
Best regards,
Benedikt
you probably already found a solution by now ... but for future reference, SilverStripe user drx has created a batch action for translations as discussed here: http://silverstripe.org/customising-the-cms/show/7318
Tip:
->createTranslation() only creates a live-record even if you call this on a stage-object created with:
$a = Versioned::get_one_by_stage($this->ClassName, 'Stage', $this->ClassName.".ID = ".$this->ID);
To create Stage and Live-Pages you have to:
$translation_GB = $this->createTranslation('en_GB');
$translation_GB->doRestoreToStage();
Saving is done automatically in both cases.
You wouldn't duplicate the site tree to create a translation. SilverStripe supports multi-lingual sites. You can read up on it here: http://doc.silverstripe.org/sapphire/en/topics/translation
If you're wanting a way to automate this there's no native support but it wouldn't be hard to do. By URL would just be a matter of adding a function to your Page_Controller or, even better, you could write a simple module if it's something you're going to be doing regularly (just look at the googlesitemaps module for an example as it loops through pages as you'd need to). You can get all pages by calling:
Versioned::get_by_stage('SiteTree', 'Live', $filter);
Then you'd create your translation(s) as you looped through. You could also do this via commandline by using SilverStripe's CMDline utility "sake": http://doc.silverstripe.org/sapphire/en/topics/commandline
I am trying to use the MVC architecture of sugarcrm to add a new action and with that a new view.
I have managed to create a controller with the action and also a class view, the only thing I can't figure out is how to create a simple html page.
Do I really have to use the metada way of sugarcrm?? I just want a simple form with two or three fields.
Are there alternatives to the metadata or do I really have to use it to create my simple page????
You will want to stay within the metadata framework to create your new page if possible. However, once you are in the view controllers, you can echo out anything you wish and still stay "upgrade safe" by overriding the display() function. But, the right way to do what you are wanting to accomplish above is to not only override the display() function but also create a new tpl file (custom/modules//tpls/view.tpl) and then perform whatever you need to perform PHP wise and then assign the variables via the smarty templating engine (I know this sounds complicated - but it's not. It's actually pretty straightforward once you understand Smarty).
One other thing - make sure you are doing all of this (including your controllers and view files) in the custom/modules directory. As this will also keep things upgrade safe. And keep you free from all kinds of headaches in the future. :)
Here is a link to the SugarCRM Developer's Guide online and also a link to their Developer's website. SugarCRM has a pretty good community of developers on the forums so feel free to ask questions there as well.
Developer's Guide:
http://developers.sugarcrm.com/docs/OS/5.2/-docs-Developer_Guides-Developer_Guide_5.2-toc.html
Developer's Site:
http://developers.sugarcrm.com/
Hope this all helps!
Try to do following:
create a new module
put your page into custom/modules/
using URL index.php?module=&action= (without php extension, of course) you can access to your page.
If you'd like to have different action name and page name then you should add the file action_file_map.php
into your module directory and specify inside the mapping:
$action_file_map['action_name'] = 'path_to_your_page';
Note that action_name must be all lowercase - the SugarController won't be able to to match mixed-case actions (true as of SugarCRM 6.1.2).