Search code examples
joomlajoomla3.3

How to create a custom component for Joomla 3.3?


I'm new to Joomla and I'm confused, so I need your advice on this. I have to create a plugin which connects to an API and shows base64 PDF on a page. So, I created my PDF viewer, but I don't know how to pack it up in Joomla. It's not just "custom HTML", it has to be a separate package so it can be installed on other Joomla sites. I guess it also has to have a database to store some settings (e.g. API URL). I want users who install this extension to be able to go to Modules > New Module > PDF Viewer, and from there they can set up API URL for that module. Users will be able to create modules of this type on multiple pages and to be able to set different API URL for every page. So, what do I need? An extension, component, module...? I searched for tutorials and read Joomla docs but I'm still confused. Please help me, what to do, some guide, where to put files, where to upload them etc. Thanks


Solution

  • You could actually go about this with a component, plugin or module:

    I think a component would be the most complex in this situation. As you are probably already aware, a component is like an application which renders itself in the main click of the website.


    If you were to create a plugin, you could generate a short code snippet based on the name of the plugin which could then be added to an article, which would then display the PDF within the article. For example:

    {PDFgen=NAME_OF_PDF}
    

    or

    {PDF}name_of_file.pdf{/PDF}
    

    Creating a module in my opinion would be the easiest. As once you've added the functionality to render the PDF, the user can either display it as a module (like a sidebar widget), or they can also import it in their article using a built in Joomla feature. Assign a custom position to the module, then add the following anywhere within an article: {loadposition XXX}, where XXX is the name of the custom position you assigned to the module.


    Out of all honest, you should develop it in a way you feel most comfortable with. Just make sure when you do it, that you stick to Joomla coding standards.

    Hope this helps