Goza Posted March 3, 2019 Posted March 3, 2019 Is there any documentation on template logic which can/cannot be used in pages (manual HTML)? using {template="userPhoto" app="core" group="global" params="$member->author(), 'tiny', $member->warningRef()"} which automatically throws errors author() using expressions will also throws errors. The only thing I found is using {member="name"} It would be nice if we could actually use {template =""} logic in pages.
opentype Posted March 3, 2019 Posted March 3, 2019 The template logic is the same everywhere. So you can call the userPhoto template in Pages, but it is up to you to make sure the variables you pass in are valid in the area you are using them.
Goza Posted March 3, 2019 Author Posted March 3, 2019 8 minutes ago, opentype said: The template logic is the same everywhere. So you can call the userPhoto template in Pages, but it is up to you to make sure the variables you pass in are valid in the area you are using them. Then I am really confused about passing variables. I thought I was getting somewhere if I tried {template="userPhoto" app="core" group="global" params="$member->name, 'tiny'"} but now it doesn't show up at all nor throw any errors.
opentype Posted March 3, 2019 Posted March 3, 2019 You are not giving any details how and where you are trying this. It’s also unclear what $member should even contain. The author of a record? The logged-in member if there is one? Again: you need to make sure the variable (in this case a member object) is fed into the area you are using it or you need to load it yourself before calling the userPhoto template.
Goza Posted March 3, 2019 Author Posted March 3, 2019 5 minutes ago, opentype said: You are not giving any details how and where you are trying this. It’s also unclear what $member should even contain. The author of a record? The logged-in member if there is one? Again: you need to make sure the variable (in this case a member object) is fed into the area you are using it or you need to load it yourself before calling the userPhoto template. I want to show a userPhoto onto a blank (manual HTML) page with no database.
opentype Posted March 3, 2019 Posted March 3, 2019 You need to create the member object yourself then. For example: {{$member = \IPS\Member::load(1);}} with 1 being the member ID. You can then pass that member object into the userPhoto template.
Goza Posted March 3, 2019 Author Posted March 3, 2019 1 hour ago, opentype said: You need to create the member object yourself then. For example: {{$member = \IPS\Member::load(1);}} with 1 being the member ID. You can then pass that member object into the userPhoto template. Thanks. Going into the right direction however going into a slight dilemma. Probably just don't know what I am doing. I got the userPhoto (default) photo to show up but the avatar/interaction isn't coming up. I need to define that as well? {{$member = \IPS\Member::load( $member->member_id);}} {template="userPhoto" app="core" group="global" params="$member, 'large'"}
Recommended Posts
Archived
This topic is now archived and is closed to further replies.