Suggestion: Do not generate EXIF data as HTML outside of template

  • I am working on my gallerys detail view and wanted to add the EXIF data. To my surprise they are generated in the model already as HTML.


    Trying to retrieve the exif data to place them into my customized data by calling $this->exifdata returns a HTML structure like this:


    Code
    <div class="jg_row1">
        <div class="jg_exif_left">
              Camera Make (Manufacturer)        
        </div>
        <div class="jg_exif_right">
              SONY&nbsp;        
        </div>     
    </div> 

    The issue is - if you have a custom template override, this will not work. It would be much better if this would be simply output as data under $this->exifdata and the template should handle the html of this and not the model.


    I will look into fixing this in the function in the model for detail view and report on this, but it would be great if it would be incorporated as a principle that model files should not output HTML and leave that to the template.

    • Offizieller Beitrag
    Zitat

    principle that model files should not output HTML and leave that to the template.

    I agree with that.


    If you like, modifying it on GitHub and create a pullrequest. If the community likes it, it will be changed in the next version.

    Wir sind auf der Suche nach Helfern für die JoomGallery 4 Entwicklung!

    Melde dich bei Interesse bei mir (Elfangor93).

    (Verfügbare Jobs: PHP-Entwicklung, Testen, Übersetzen, Dokumentation)

  • Sorry, not on Github, but finally got time to look into this. Solution is super simple.

    In the model for the detail view, just add this on line 630


    Code
            $this->_exifdata  = $exif_array;
          return true;

    you could obviously add a setting in the configuration if the user wants a data or graphical output of the EXIF data and encapsulate this into an if condition.


    From here onwards, the data are easily used in the template directly and can be used in any way you want and anywhere in the design you want.