Can the Joomla jConfig be extended with an administrator plugin? - joomla2.5

I'm trying to add some external configuration parameters to a new J2.5 site, and before I resort to hacks, I want to know if it is possible to write a plugin that will actually integrate with, or extend the jConfig object.
I have been googling, and cannot find any discussion or example of such a thing - only component or module configuration, so wanted to know if anyone had attempted this, or knew of a "native" way of accomplishing it.
Note - We'd accomplished this in earlier versions by way of a system plugin that set a global variable to make the information available, but we're hoping to include it in the Joomla Global Configuration to be able to use native Joomla config logic.

The short answer is no, you can't. With a plugin it's only possible to override some minor classes, when the plugins files are first loaded (which would be the first hook for our custom code) JConfig is already loaded along with another 40 classes.
You could however extend it once it's loaded, add your parameters, save, and those should be persisted when the user saves from the backend, and made available in the following requests. Provided you're not saving too many it could work fine.
Otherwise just put your parameters in the component (which would be the standard Joomla way).

Related

opencart create new module with order

I am new to opencart and want to create new extension module. After order placed and payment process completed after that I need to call 3rd party API.
So, Is there any hooks (like WordPress or Prestashop) that I can apply and use into my module files?
I am currently using opencart version - 2.3.0.2
OpenCart doesn't have any hooks, only events system, which is pretty weak. Instead it uses VQMod. This is a pretty powerful tool for developers, who know some PHP. It works similar to WordPress hooks, but gives you unlimited options.
Hooks use certain points in the code or fire certain events, but with VQMod you can put your code literally anywhere. You only need to find the desired line and put your code before or after it, even replace it, if necessary.
If you're familiar with WP hooks and filters, I'm pretty sure you'll handle VQMod well.
There are three following way :
Opencart Events
Vqmod
Ocmod
PS: I prefer to use ocmod.

Beginning Joomla Development - Templates and Modules?

I am planning to begin my Joomla development adventures, so I have been digging up some resources on Joomla beginner such as:
Joomla 2.5 Beginner Guide
I think I have grasped the fundamental concept, though I have a doubt that if anyone doesn't mind clearing up for me.
If I have my own template ( I am planning to use my own Twitter Bootstrap template ), and I am planning to convert it to Joomla, and inside that template there are already samples for some modules such as front page slider, testimonials, partner links, etc, from what I understood these have to go as modules, since Joomla allows one component, and many modules in a page (hence a index page might have Welcome message as component, and sliding banner, testimonials as modules).
So my question is do I have to write these testimonials, page slider modules on my own? Since I already have the samples (css and html) and I know how they will be positioned. Wouldn't it be a bit of overkill to write modules for each? What if at later stage I am making another website, and I have another template?
Also, from examples I have seen, Joomla template have only one html template (index.php) which defines all the positions. If I want to define two possible layout for one template, is that possible? Or it has to go in different templates, and I assign them separately in my Template Manager.
Ok firstly, as for the Joomla version, you have 2 choices.
Joomla 2.5 as it's the recommended long term version.
Joomla 3.0, the new short term release which is completely based on Bootstrap, therefore it might be easier to adapt it to make it look like your template.
usually I would recommend Joomla 2.5 but in your case I think Joomla 3.0 might be the best way to go.
As for the modules, you don't necessarily have to write them yourself. You can download all these sort of things from the Joomla Extensions Directory. If you are worried about positioning of modules, then simply ensure that the template has the module positions in the correct place. Using the Joomla 3.0 template and adapting it to look like your template will be much easier when it comes to modules, as it already has a lot or pre-defined positions. If you feel the need to add more, you can do so. See links below:
Adding you own module positions in Joomla 1.5/2.5
Adding you own module positions in Joomla 3.0
I hope this helps you a little bit on your Joomla adventure and good luck.
Almost forgot, please also make sure you keep your Joomla version up to date unlike a lot of the people that post questions on here :) I posted an answer as to why it's important here
You absolutely right about Joomla allowing 1 component and many modules! Your also fine to convert your template into a Joomla template. Although note as Joomla 3.0 uses bootstrap (but is still very new and having many new features added to it - even though its technically stable) and thus it might be easier for you to use that. You can easily include bootstrap etc through that framework as well. Link here for how to do that
See the link here about module and module positions in templates. Whilst the numbers at the top say this is for 1.0,1.5 and 2.5. The bit under the 2.5 header also applies to Joomla 3.0!
In terms of different layouts for the template generally its good practice to have two separate templates if the layout changes are significant. However if the layouts differences are small, there is nothing wrong with adding in a Form Field and creating two template styles in the backend and just choosing the layout with a form field for each style!
If you want to use your customized modules I'm afraid yes you do have to do this. However there are module and component writers out there which can make the basics up for you so you can almost copy and paste your code straight into one file (with a few changes here and there). You can also use the Joomla Extension directory though - you may even find something you like more!
In terms of using the modules/components on another site this is actually much easier. Once created you can just go into the Joomla backend and install your extension again and tweak it how you want after that with either FormFields or in template overrides!
Any more questions feel free to ask!

Module overriding in Joomla 1.6

I am new to Joomla, started learning it just a day ago and didn't manage to find an answer to my question in the docs (which suck real bad compared to Drupal).
So what I want to do is override the whole module in a template. The documentation only suggests I can override the markup of a module by placing corresponding files in the html folder, but I have to make some corrections to the actual logic. Is copying the module, changing and then installing it as a separate entity the only way to go? I mean it makes sense that "template" folder is for "views" but with the kind of application I have to develop it is gonna be annoying...
Yeah, you can only override views.
If you want to override logic, you have 2 options:
Change the actual logic in-place, which leads to problems on updating etc
Duplicate the module and change the logic, as you suggested
One other way to consider is to replicate or fix the logic in the template. While this is not a very slick way of doing it, it is faster, especially than duplicating a whole component.
Note that you can also add your own libraries to the Joomla libraries folder to centralize your own code.
Further, if you manage your code with (for example) svn, you should not have any problems on upgrades with creating new views that may include their own logic.

Best way to integrate PHP forum into Django site?

Suppose you are running a Django site, and have a legacy PHP forum to support and integrate into your site, since current Django forum solutions are not mature enough.
What is the best way to do this?
Currently I have a simple view, which renders a very simple template which extends my site's base template, and the content area has nothing but an <IFRAME> which holds the forum as its src. A small jQuery function is used to maximize the <IFRAME>'s height (once it finishes loading) so as to contain 100% of the forum content.
But all of this sounds pretty awkward. How would you go about this?
There are a few options. None are ideal (but mixing two platforms never is!)
Use iframes as you've suggested (bad as the address in the address bar is always that of the django page and if somebody copes a link off the forum, it will be the PHP forum, not the django holder)
Use iframes but instead of using the same src all the time, parse the URL and append the relative bit onto the src of the iframe. ie if django sees /forum/this-url, set the src to http://forum-address/this-url and make sure all your links target parent. This has the advantage of showing the correct link in the address bar at all times (rather than it always being /forum/). You'll need to hack your forum for this to work.
Proxy the content and inject it into the page properly. You'll need to pass cookies and it might get really messy but in most terms, this is a great way to integrate things because your links will always be correct. You'll need to butcher your forum theme to strip out everything outside and including the <body> tags.
Theme your forum in the same way as the Django site. This would give best performance but you might have issues if you use dynamic stuff in your django template. An option to get around this is by having the django template cache things to memcache and using php-memcache to pull them out into your forum template.
I have done both 3 and 4 in the past. I used 3 for a very simple form (so didn't have to deal with cookies and sessions as you will). I used 4 for integrating a FluxBB forum into a Wordpress install. Both PHP but it would be uber bloat to load FluxBB inside Wordpress. I cached the dynamic template things into memcache and pulled them out in the forum template.
For this, I would probably suggest going with #4. It's a pain in the arse having to maintain two themes but it's by far the fastest performing solution.
When I read the question summary I immediately thought that you would need some kind of script, which could be linked to a signal via the Dispatcher in Django, to syncronize the user database from your Django site to the forum. This would keep the authentication side of things in check - but you still need to do one of the things that Oli has suggested, to make them look the same.
Themeing will probably be the least hassle-free route, but that's not to say it will be easy!

Converting registry access to db calls from MFC Feature Pack

We may start converting an old VS2003 MFC project to use the fancy new features provided by the MFC Feature Pack and VS2008. Several of the new UI controls would be very nice except for one thing - they automatically save their information to the registry. I don't have a problem with the registry, but for the multiple environments the users use out program from, it's much easier to save user data to the database.
So, I'm hoping that there is one main "access the registry" function that could be overloaded to point the database. But brief investigation hasn't turned up anything. Has anyone else had any success doing something similar?
It seems like it should be possible to do what you're suggesting, according to the information on this page in MSDN. I haven't tried this myself, so I don't know how difficult it will be in practice.
According to the documentation, you should create a class that inherits CSettingsStore to read and write the settings, and call CSettingsStoreSP::SetRuntimeClass so that the framework uses your class instead of the default.
The MFC feature pack uses code supplied by BCGSoft and they added this feature (so you can save state to an XML file, database, etc.) way back in 2001. I don't have the feature pack on this PC but try looking for a class called something like CMFCRegistrySP.
I will check myself tomorrow.
Does the StateCollection sample do this?
http://msdn.microsoft.com/en-us/library/bb983406.aspx