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

ep.octcms.1211904
ep.octcms.1211904

Hi

Is there a way to change the included file that renders html in a component? I have created a Account plugin with a login component:

account components login default.htm (will contain login form html) loggedin.htm (will contain logout button)

Can I put something in the onRender() method to point to the loggedin.htm when the user is logged in? Something like this pseudocode: if() use loggedin.htm else use default.htm

thanks Ewen

ep.octcms.1211904
ep.octcms.1211904

Try again with markdown formatting...

account
      components
               login
                       default.htm (will contain login form html)
                       loggedin.htm (will contain logout button)

Can I put something in the onRender() method to point to the loggedin.htm when the user is logged in? Something like this pseudocode: if(logged_in) use loggedin.htm else use default.htm

Daniel81
Daniel81

You can use {% component 'componentAlias::loggedin' %}

Troiscent
Troiscent

Hi,

The only way to switch template file in when you call the component in CMS page or partial ?

I created a "template" option in my component settings that scan all files under the component template directory. I would like to be able to load the correct template file depending on the settings in my component, not by changing the way to call it. Is it possible ?

1-4 of 4

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