This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

raheel
raheel

Hello Guys,

I have a partial within a component which displays an image tag as follows:

<img src="{{ '/mysitefolder/plugins/author/plugin/assets/images/someimage.gif' }}" />

It's working just fine, but i need a clean way to do this. Means i don't want to type-in the complete absolute path to the image file within a plugin.

Something like <img src="{{ assets/images/someimage.gif }}" /> assuming the partial resides in the same plugin/component.

Thanks.

Last updated

raheel
raheel

May be something like twig filter "theme" :

<img src="{{ 'assets/images/someimage.gif'|theme }}" />

What if we can have something like: <img src="{{ 'assets/images/someimage.gif'|plugin }}" />

which translates the markup to: <img src="{{ '/sitefolder/plugins/author/plugin/assets/images/someimage.gif'|theme }}" />

Last updated

TurtleIsland
TurtleIsland

how to do this right anyone please?

fredericomarinho16918
fredericomarinho16918

I also would like to know.

laszlo.zenware.io
laszlo.zenware.io

For backend menu pages you can do something like this:

<img src="<?= url('/plugins/author/plugin/assets/images/someimage.gif') ?>">

If would be simpler if partials in backend settings pages supported twig but they don't.

1-5 of 5

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.