4

I've written a rendererer library (on basis of JDocumentHTML) for Joomla 3, needed for a component of mine. It has to be put in a subfolder of /libraries/joomla/document for now. Now I'd like to pack it and make it installable via the package installer of joomla. I've found no tutorial and no book so far emphasizing the way to do it, except an old post explaining a little bit how to make ONE library (and not a rendering one) able to be installed at the root of the library folder in Joomla 1.6.

Does anybody know how to do that?

More informations and reformulation:

I got this PDF rendering class, which is extending JDocument, stuffed in a custom library. Ideally, I not only want to be able to distribute a .zip of this library in order to make it installable via the file manager. That I have already done. I would like to be able to actually render something using it.

Extending the core Joomla rendering functions is a really easy thing to do if you copy your custom renderer to the right place via ftp (to /libraries/joomla/document/ to be specific), but I don't have a clue how to do it via a custom library installed through the extension mananger, in order not to mess around in the vendor directories.

So for now, I have:

  • packed my rendering library.
  • installed it. that works. Now, how could I actually use it?

4 Answers 4

3

You will need to combine the component and library into a package type extension.

So create a new XML file and make sure the type it set correctly like so:

<extension type="package" version="3.0" method="upgrade">

Then you need to define what extensions will be installed within the package like so:

<files folder="packages">
   <file type="component" id="com_helloworld" >com_helloworld.zip</file>
   <file type="library" id="helloworld">lib_helloworld.zip</file>
</files>

For more information on this, have a read of the following

https://docs.joomla.org/Package

2

OK, I found a way.

Basically, the simplest way to make it accessible is to write your library.xml in order to make it a mere addon to jdocument. In my case, wanting to do a PDF renderer, my library structure was as follows

lib_pdfrenderer
|--pdf.xml
|--document
   |--pdf
      |--pdf.php

and my pdf.xml as follows:

<?xml version="1.0" encoding="utf-8"?>
<extension type="library" version="3.x" method="upgrade">
    <name>PDF rendering addon</name>
    <libraryname>joomla</libraryname>
    <author>...</author>
    <creationDate>2015</creationDate>
    <copyright>...</copyright>
    <license>GNU LESSER GENERAL PUBLIC LICENSE Version 2</license>
    <authorUrl>...</authorUrl>
    <version>1.0</version>
    <description>Addon to enable JDocument to render PDF</description>
    <files>
        <folder>document</folder>
    </files>
</extension>

In fact, this does exactly what I did manually before: it installs the library into the vendor folders. Not the best way I'm sure, but I couldn't figure out something else

1

It is not a best practice to add your classes into a existing directory. In future, the owner might overwrite it.

In general, lilbraries are installed at /libraries and auto-loaded when needed.

1
  • Of course it's not best practice, that is why I want to do it with a package. But I don't find any piece of information on how to let the view be rendered by my own custom library instead of any subclass of JDocument found in the /libraries/joomla/document folder.
    – Khaarkh
    Jan 31, 2015 at 13:59
1

I had the same problem as you some time ago. Here are some tips:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.