Get module ID in default.php file - joomla

Hey guys how is it going!
I am trying check the running module ID in the default.php file. I need to get the module ID and go from there. I have read that $module->id should store that number in that file but I don't know why it does not print anything when I access it.
What else can I do? Do I have any option to solve my problem? I am dealing with Joomla 1.5.3
Really really need to get this done ASAP, give me a hand with this one please.
Thank you.

Here's the class and method to access a module id and other useful info about a module:
http://docs.joomla.org/JModuleHelper/getModule

Related

How to select module name in urlfor function inside template

Im working in a beego application with 2 modules, and has a controller with the same name in both modules.
When I use {{urlfor}} in template the generated url is linking with the other module.
Anybody know if its posible select module name in urlfor function? I search in the docs and cant see any reference about. Im currently use beego 1.4.3
Thanks in advance
For anybody with the same issue:
The problem is how I implemented the application folder structure for modules. It seems not be compatible with {{urlfor}}.
The correct answer come from github: https://github.com/astaxie/beego/issues/1100
In the link you can found the correct directory tree

Has Magento a fallback for default email templates?

Hi I have created an module with a custom transactional email, which works fine when i place the default-template-file in
app/locale/de_DE/template/email/sales/mymail.html
but i need to place it into my template
app/design/frontend/ultimo/custom/locale/de_DE/templete/email/sales/mymail.html
but on this path it isn't found, i even tried otherplaces like
app/design/frontend/base/default/locale/de_DE/templete/email/sales/mymail.html
app/design/adminhtml/default/default/locale/de_DE/templete/email/sales/mymail.html
but neither works. Isn't there any fallback mechanism for these file? If yes, can anyone explain it to me?
Thanks

how can i find the version of codeigniter an application was written in?

I'm reviewing someone's code and I can see that they're using codeigniter. But I'm trying to figure out which version they've used. I've been rooting around in the directory structure to find some information but haven't been successful yet.
Thanks.
Inside the framework, it's defined in 'CI_VERSION'.
Path is system/core/CodeIgniter.php
define('CI_VERSION', '2.1.3');
Simple as this;
echo CI_VERSION;
The constant is globally available and is pre-filled with the release version of the code you have.
Just put the echo in an empty controller and call it in the browser to test it.

How to view drupal 7 sessions from an external PHP page?

I installed drupal 7 and I need to include a block of PHP code in the user profile page.
I created a new block and I put this code in it:
"include (http://mysite/sites/all/themes/campi_aggiuntivi.php)"
In "campi_aggiuntivi.php" I put the following code:
session_start ();
print_r ($ _SESSION);
But it returns an empty array.
How do I interact with drupal sessions in this external page?
Thank you very much for your answares.
Thank you all for your answers.
I'm trying to install a module and insert it into a block avege as I suggested.
I created the file test.info
name = Test Block
description = description Test Block
package = package Test Block
core = 7.x
dependencies[] = block
; Information added by drupal.org packaging script on 2013-02-01
version = "7.x-1.x-dev"
core = "7.x"
project = "Test Block"
datestamp = "1359680350"
But I can not figure out which function I put in the file test.module, to insert the test module management screen Blocks
Can you help me please?
Thank you again to all
I think you need to include Drupal Bootstrap and a few other necessary procedures. Here's a link to an issue on d.o that might help.
1st thing i want to suggest is don't include like this:
"include (http://mysite/sites/all/themes/campi_aggiuntivi.php)"
Use local path instead: "include (sites/all/themes/campi_aggiuntivi.php)"
But this depends on from where you are calling, if both the files are at same location(calling in user profile tpl file) then this might work: "include (campi_aggiuntivi.php)"
I presume you need session details to figure-out the user id, that information can be retrieved from $profile variable or arg(1)
I have not tested your code but the way you are trying to do is not the conventional way to extend Drupal functionality.
Also i hope print_r ($ _SESSION); is actually print_r ($_SESSION); in your code, i.e. without spaces.
If you want to add a block in user profile page, i recommend doing it the drupal way.
Drupal already has an excellent example for creating a block programmatically. Here is the link.
Have a look at block_example module inside it. It will give you relevant example codes that you can use to create the block.
The example also contains information about how to make the block appear in certain pages by default.
After you create the block place them in the region you would want to, like left sidebar, content etc of the relevant theme that is enabled on user profile pages.
Inside your custom module you would access to $_SESSION variable.
From here on you can include the code in campi_aggiuntivi.php inside your module itself.
Or use the following foolproof method to load the file. This would even work when you call it from a theme.
Say you want to use custom_module_name.campi_aggiuntivi.inc located in your custom module, from a theme then you can use module_load_include
For example,
module_load_include('inc', 'custom_module_name', 'custom_module_name.campi_aggiuntivi');
the above call would load custom_module_name.campi_aggiuntivi.inc from custom_module_name module folder. This way you don't have to hard code the path required to access the file.
Based on your update.. it sounds like you are now trying to create a block programmatically. There are example modules that you can download on Drupal.org. There is a block module in that download.

Joomla two module using same helper.php

I've built two custom modules for Joomla ("reservation" and "contact") which are working just fine, however time to time I have to upgrade them.
Is it possible to make them to share the same "helper.php" so I could keep code in one place? For example the post function is the same for these two modules. I want the "contact" module to use the "reservation" helper.php post function.
Thanks
You can simply include the reservation module helper inside the contact module and use it.
For example lets say that your modules are mod_reservation and mod_contact, in mod_contact.php you include the reservation helper file and use it like this:
require_once JPATH_SITE.DS."modules".DS."mod_reservation".DS."helper.php";
modReservationHelper::post();
Or you make a custom helper module,, which is needed in order for the other 2 to work. I dont know for sure but I thought you can check for other modules when installing a module. In that check you check for the helper module and if not present you give a error. You could also say that a certain module needs atleast version X.XX.XX of the helper module and if the version is too long also give an error in during the install of the module.

Resources