Custom php code in joomla 2.5 component - joomla

Hello is there any way to use a custom php code as component, in joomla 1.5 I was using Joomla PHP Pages Component from http://www.fijiwebdesign.com/products/joomla-php-pages.html.
With this component I could assign a php file to any menu and execute any php command including query to select/insert/update database.
Unfortunately is not updated to work with joomal 2.5
Is there any other component or tricks to do that?
Thanks

Did you check following links ?
http://extensions.joomla.org/extensions/edition/custom-code-in-content/1023
http://joomlacode.org/gf/project/jincludes
http://www.kksou.com/php-gtk2/Joomla/DirectPHP-plugin.php
http://extensions.joomla.org/extensions/edition/custom-code-in-modules/6474
http://extensions.joomla.org/extensions/edition/custom-code-in-modules/15251
http://extensions.joomla.org/extensions/edition/custom-code-in-modules/4971
http://extensions.joomla.org/extensions/edition/custom-code-in-content/5051

I use this. Its very quick, and you can even make fully functioning database applications in a jiffy
It comes with a few small bugs I noticed of which the one to mention is the fact that the default.xml on components/com_YOURCOM/views/YOURTHING/tmpl is not generated... So you have to add that otherwise it doesnt show up as a choice for a menu-item-type.
The default.xml only needs something like this:
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="YOURNAME">
<message>YOUR AWESOME component.</message>
</layout>
</metadata>
Good luck!

Related

Incorrect Magento 2 layouts override behavior

Installed clear magento 2.3.2
Created simple custom theme which contain (theme.xml, registration.php and CustomTheme/Magento_Customer/layout/customer_account_create.xml).
Also I created a simple extension which add a custom field to customer accout create form (This extension also use customer_account_create.xml).
<body>
<referenceContainer name="form.additional.info">
<block class="CompanyName\ModuleName\Block\Test" name="test"
template="CompanyName_ModuleName::form/test.phtml"/>
</referenceContainer>
</body>
After that I got strange behavior:
If my CustomTheme/Magento_Customer/layout/customer_account_create.xml as is like original file from core, non-standard field is added to the form without problems from my custom extension.
But if I will modify my file CustomTheme/Magento_Customer/layout/customer_account_create.xml (for example I just added this string to remove minicart: `).
My non-standard field does not apply to the form
Everything looks as if I modify the layout for my needs in custom theme (delete some elements from the registration page), then all other custom extension that use this layout or reference to this layout will stop working.
https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-override.html
I think you need to read a little more the concepts and process of development of your own custom theme before doing any big modifications, at the end you will have a really bad outcome and not sustainable code.
I figured out this issue.
Me helped this sections of the documentation
https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-extend.html
https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-override.html

How to add a new page to Joomla Admin panel

I'm new to Joomla. I need to add a new custom PHP page inside Joomla admin panel (not on the main site) to display some data from my own tables.
My Joomla version is 3.4.1 Stable.
Please help me.
Thank you.
You might be able to inject a single page to display the data - but I think more than likely your best bet (to do it properly without hacking stuff) might be to develop a small component to handle it best.
By creating the admin component you can create the page you want and display your data however you decide.
If memory serves me correctly, you can create a folder (say com_mycomponent) and create 'mycomponent.php' in that directory. Then you add your php code to that page to do whatever you want. Of course, this is for the most basic - barebones idea.
I will expand because to the best of my understanding we will need an installer to actually 'install' the component (although it's been a while since I've developed heavily in Joomla). If you don't create the installer I think it will cause errors within the system.
Create your directory
Create one or two directories in the directory
admin (required)
site (optional)
Create 'mycomponent.php' in the admin directory (and site directory if you created one) and write your desired
code into the admin file (and/or) site file.
Create 'mycomponent.xml' file in com_mycomponent
Open 'mycomponent.xml' file and paste the below code
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.4.0">
<name>Your Name</name>
<creationDate>2015-05-13</creationDate>
<author>You</author>
<authorEmail>you#example.com</authorEmail>
<description>My Joomla Component</description>
<files folder="site">
<filename>mycomponent.php</filename>
</files>
<administration>
<menu>MyComponent</menu>
<files folder="admin">
<filename>mycomponent.php</filename>
</files>
</administration>
</extension>
You can remove the following if you did not create the 'site' directory:
<files folder="site">
<filename>mycomponent.php</filename>
</files>
Zip All the contents under com_mycomponent lets name it
com_mycomponent.zip
Login to your joomla admin and install com_mycomponent (the same way
you would any extension you download)
After it installs, you can view your page at
http://yoursite.com/administrator/index.php?option=com_mycomponent
What I usually do is create an admin module to display the data. It's a bit quick and dirty but it works. Also there are some extensions in the JED that will let you display data from any table.

Joomla Administration of Modules not possible

I have a joomla 2.5 that after a migration happens the following problem:
I can not manage one module. When I try to manage in the backend I look this:
http://i.stack.imgur.com/0pVJM.png
(Is not css problem)
Only happens with zentools module, and the rest of modules and frontend works properly.
Any solution or idea?
thx
I see 2 possibilities:
1. Turn on PHP error_reporting
2. View contains die() or exit() before all content is loaded

Payment fields missing from Authorize.net checkout method

This is a pretty strange issue. If I enable the Authorize.net payment method, the input fields to enter your CC details is missing from HTML. This is a pretty much out of the box installation with just some theme work having been done, and I didn't touch the opc templates.
If I enable Saved CC payment method, the fields appear correctly.
I did not make any changes to the OOTB Authorize.net files in Magneto and even tried disabling my entire theme and it doesn't have any impact.
Screenshot of code:
http://cl.ly/image/3g1n2x021N2s
After looking into this more, it looks like this line in templates/checkout/payments/method.phtml is not returning any HTML:
$this->getPaymentMethodFormHtml($_method)
I found this method and it in-turn is trying to load a child.
public function getPaymentMethodFormHtml(Mage_Payment_Model_Method_Abstract $method)
{
return $this->getChildHtml('payment.method.' . $method->getCode());
}
That is about how far I have gotten.
I would try the following steps:
Check your exception log under /var/log/exception.log
Check your PHP error log
Disable your current theme by renaming your theme folder eg: /app/design/frontend/default/themename >> /app/design/frontend/default/_themename - this rules out the possibility of invalid theme/layout XML issues. Make sure it falls back to an untouched base default theme!
Disable your non-standard extensions by setting <active>false</active> in the XMLs found under /app/etc/modules one by one.
Try see if there is a difference in value $method->getCode() when saved CC is turned on & off.
If possible, update the Authorize.net extension. If not, at least check if your /app/etc/modules/Mage_Authorizenet.xml is as follows:
<config>
<modules>
<Mage_Authorizenet>
<active>true</active>
<codePool>core</codePool>
<depends>
<Mage_Paygate/>
<Mage_Sales/>
<Mage_Checkout/>
</depends>
</Mage_Authorizenet>
</modules>
</config>
This is a workaround if you don't find any solution for your problem.
You can create your own payment form for authorize.net
Authorize.net form used cc.phtml file for display Authorize.net fields so you can copy this file and set this form from xml.
Go to your checkout.xmland in <checkout_onepage_index translate="label"> tag find checkout.payment.methods which display all methods put action methods something like this
<action method="setMethodFormTemplate"><method>authorizenet</method><template>payment/form/authorizenet.phtml(which is copy of your cc.phtml)</template></action>
I have not test it.
Authorize.net use this block for display form fields so further you can look into this file
app\code\core\Mage\Paygate\Block\Authorizenet\Form\Cc.php
You can also check if Mage_Authorizenet or Mage_Paygate module are disabled in your Magento admin.
System -> ADVANCED -> Advanced
Make sure that they are enabled there.

Calling a Static Custom Module Block in a CMS page

In my CMS contact-us page, I have the following code:
{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}
Which pulls in Magento's standard Contact Form. I have installed a new module from Fontis called recaptcha to prevent spam. This is located my_theme/default/template/fontis/recaptcha/contacts.phtml.
Is anyone able to tell me how I correctly modify the above code to use the new form please?
I have tried changing: template="contacts/form.phtml" to template="fontis/recaptcha/contacts.phtml" but this doesnt seem to work, not sure if I need to alter the block type to make it work.
Thanks in advance for any help
John
Your modification is generally correct to change a template path. Specifically, what do you mean when you say it "doesn't" work? Without more information on what you're seeing, it's difficult to help you debug this issue.
Thanks!
Joe
Sounds like a caching issue to me, or that you're changing the template on the wrong declaration. First, turn off all caching on your site and try again. If that doesn't work, turn on template path hints and make sure that you are editing what you think you are.

Resources