You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#116935 Files inserting template

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Friday, 08 November 2024 15:06 GMT

semaphore

Hi,

We are looking for a way to "template" the file link/insertion.

For example we need to add some div, class here and here instead of the actual wf_file you set.

In a perfect worl the end user can select between multiple template.

Thanks for your help

Ryan

There isn't currently a way to combine templates with inserts from other dialogs like Image Manager and File Manager (a project I want to start sometime soon), but you can use Template Items to create a list of items to select, which will show a dialog for the user to select a file, and add other values like a title.

See Template Items here - https://www.joomlacontenteditor.net/support/documentation/template-manager/template-manager-configuration

So for example you could create a Template Item with the following HTML:

<div class="foo">
    <a href="https://www.joomlacontenteditor.net/${URL:file}" title="${Description}" class="bar">${Name}</a>
</div>

Which will give you a dialog like this:

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

semaphore

Thanks for the example and pointing out to the Template plugin.

How can we get the information about the file in the callback for the templating : size, creation date, extention, category folder (optional) ?

Ryan

Please try JCE Pro 2.9.82 RC - https://www.joomlacontenteditor.net/downloads/editor/pro/development

Clear your browser cache after install.

This adds support for size, date, filename and extension variables, eg:

<div class="foo">
    <a href="https://www.joomlacontenteditor.net/${URL:file}" title="${Description}" class="bar">${FileName}</a>
    <span class="date">${Date:disabled}</span>
    <span class="size">${Size:disabled}</span>
</div>

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Ryan

FYI - using :disabled next to the variable eg: ${Size:disabled} will disable the input field, so the user cannot change the value.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

semaphore

Veryyyy nice !
So, variables are : Size, Date and Extention ?

Ryan

The new variables are Size, Date, Extension, Filename (the file name without the extension)

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Ryan

JCE Pro 2.9.82 RC3 - https://www.joomlacontenteditor.net/downloads/editor/pro/development - adds a hidden type for variables, allowing you to use the value in the template but not expose it for editing, for example, in the download attribute the filename and extension values are used but are not visible in the form:

<div class="foo">
    <a href="https://www.joomlacontenteditor.net/${URL:file}" title="${Description}" download="${filename:hidden}.${extension:hidden}" class="bar">${FileName}</a>
    <span class="date">${Date:disabled}</span>
    <span class="size">${Size:disabled}</span>
</div>

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.