inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on May 25, 2017 1:33:01 GMT -8
Included a picture as guests can't actually see the set up fully. So here's the site: wearehuman.boards.net/Let me walk through line by line in effect what's right/what's wrong: Title - Right Plain text line - Correct (so the intro) Link to Dashboard - Correct Fishing Camp Pilgrim Robmin - wrong shouldn't be there The links below should be showing as just the link name not the link followed by the link name. Here's the code: <div class="cust-nav-shower container" id="cust-nav-toggle"><div id="cust-nav-title" class="title-bar"><h2>Your Navigation</h2></div>{if $[current_user.is_member]}If you input some links and names in your profile page they will show up here <br />{else}Sorry guest - this is a member only feature<br />{/if}<a href="/page/dashboard">Dashboard</a> <br />
{foreach $[current_user.custom_field]}
{if $[current_user.custom_field.name] = "Cust Nav Link 1"}<a href="$[current_user.custom_field.value]">{if $[current_user.custom_field.name] = "Cust Nav Link 1 Name"}$[current_user.custom_field.value]{/if}</a>
{elseif $[current_user.custom_field.name] = "Cust Nav Link 2"}<a href="$[current_user.custom_field.value]">{if $[current_user.custom_field.name] = "Cust Nav Link 2 Name"}$[current_user.custom_field.value]{/if}</a>
{elseif $[current_user.custom_field.name] = "Cust Nav Link 3"}<a href="$[current_user.custom_field.value]">{if $[current_user.custom_field.name] = "Cust Nav Link 3 Name"}$[current_user.custom_field.value]{/if}</a>
{elseif $[current_user.custom_field.name] = "Cust Nav Link 4"}<a href="$[current_user.custom_field.value]">{if $[current_user.custom_field.name] = "Cust Nav Link 4 Name"}$[current_user.custom_field.value]{/if}</a>
{/if}{/foreach}
</div> Can anyone see if I've newb'd anywhere and how I could make the display work how I want, please? Tagging Ben Goodman because you've done similar
|
|
inherit
229600
0
Sept 7, 2022 11:09:51 GMT -8
Ben Goodman
96
February 2016
benhun
|
Post by Ben Goodman on May 25, 2017 7:16:59 GMT -8
Boy_Wonder, your code seems more organized than mine lol xD I put the if/else sections inside the <a href=" part"> part. Also, I think your problem is with the {foreach} section, but I am not entirely sure about it. I am leaving my code here, hoping that it will solve your problem. <table style="background-color:black;border: 2px solid black;border-radius:18px;" width="100%" >
<tbody>
<tr>
<td class="private_menu"><a href="{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Els? link"}$[current_user.mini_custom_field.value]{/foreach}">{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Els? link szövege"}$[current_user.mini_custom_field.value]{/foreach} </a></td>
<td class="private_menu"><a href="{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Második link"}$[current_user.mini_custom_field.value]{/foreach}">{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Második link szövege"}$[current_user.mini_custom_field.value]{/foreach} </a></td>
<td class="private_menu"><a href="{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Harmadik link"}$[current_user.mini_custom_field.value]{/foreach}">{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Harmadik link szövege}$[current_user.mini_custom_field.value]{/foreach} </a></td>
<td class="private_menu"><a href="{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Negyedik link"}$[current_user.mini_custom_field.value]{/foreach}">{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Negyedik link szövege"}$[current_user.mini_custom_field.value]{/foreach} </a></td>
<td class="private_menu"><a href="{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Ötödik link"}$[current_user.mini_custom_field.value]{/foreach}">{foreach $[current_user.mini_custom_field]}{if $[current_user.mini_custom_field.name] == "Ötödik link szövege"}$[current_user.mini_custom_field.value]{/foreach} </a></td>
</tr>
</tbody>
</table>
|
|
inherit
223590
0
May 17, 2023 9:13:21 GMT -8
Kitty Katt
My Username is @kittykatt (with 2 t's in katt)
819
July 2015
kittykatt
|
Post by Kitty Katt on May 25, 2017 10:06:30 GMT -8
Hello. I did notice this: You are trying to check for two different custom field names in the same line. On that pass, the custom field name will only have one value for it. So, if the custom field name, at that point, is equal to "Cust Nav Link 1", how can it also equal "Cust Nav Link 1 Name" on that same pass? I hope that helps. Edit: I hear that Tumbleweed is very good with templates, so perhaps she can (if willing) verify what I have posted or not.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on May 25, 2017 11:40:45 GMT -8
I've tried the route you did it Ben - it might be that I have more custom profile field names but its not wanting to play that way either. Brian - if you want to take a look as well. Kitty Katt - I know tumbleweed tends to bow out of anything I do template related XD
|
|
Kami
Forum Cat
Posts: 40,048
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,048
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on May 25, 2017 12:13:23 GMT -8
You cannot nest if statements for the mini profile custom fields. You would have to do a sort of hacky work around: To work around it is kind of hacky, but I wind up wrapping variables around each portion of the HTML, eg:
[variable 1 start] <a href="link"> [/variable 1]
[variable2]
[variable 1 start] </a> [/variable 1]
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on May 25, 2017 12:18:57 GMT -8
You cannot nest if statements for the mini profile custom fields. You would have to do a sort of hacky work around: To work around it is kind of hacky, but I wind up wrapping variables around each portion of the HTML, eg:
[variable 1 start] <a href="link"> [/variable 1]
[variable2]
[variable 1 start] </a> [/variable 1]
So would it be like this: {foreach $[current_user.custom_field]}
{if $[current_user.custom_field.name] = "Cust Nav Link 1"}<a href="$[current_user.custom_field.value]">{/if} {/foreach} {foreach $[current_user.custom_field}{if $[current_user.custom_field.name] = "Cust Nav Link 1 Name"}$[current_user.custom_field.value]{/if}{/foreach} {foreach $[current_user.custom_field}{if $[current_user.custom_field.name] = "Cust Nav Link 1"}</a>{/if}{/foreach}
|
|
Kami
Forum Cat
Posts: 40,048
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,048
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on May 25, 2017 14:32:46 GMT -8
I don't think you need to do the foreach every time, I didn't on mine.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on May 26, 2017 1:24:08 GMT -8
<div class="cust-nav-shower container" id="cust-nav-toggle" style="overflow: auto;"><div id="cust-nav-title" class="title-bar"><h2>Your Navigation</h2></div>{if $[current_user.is_member]}If you input some links and names in your profile page they will show up here <br />{else}Sorry guest - this is a member only feature<br />{/if}<a href="/page/dashboard">Dashboard</a> <br /> {foreach $[current_user.custom_field]} {if $[current_user.custom_field.name] = "Cust Nav Link 1"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] = "Cust Nav Link 1 Name"}$[current_user.custom_field.value]{/if} {if $[current_user.custom_field.name] = "Cust Nav Link 1"}</a>{/if} {if $[current_user.custom_field.name] = "Cust Nav Link 2"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] = "Cust Nav Link 2 Name"}$[current_user.custom_field.value]{/if} {if $[current_user.custom_field.name] = "Cust Nav Link 2"}</a>{/if} {if $[current_user.custom_field.name] = "Cust Nav Link 3"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] = "Cust Nav Link 3 Name"}$[current_user.custom_field.value]{/if}{if $[current_user.custom_field.name] = "Cust Nav Link 3"}</a>{/if} {if $[current_user.custom_field.name] = "Cust Nav Link 4"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] = "Cust Nav Link 4 Name"}$[current_user.custom_field.value]{/if}{if $[current_user.custom_field.name] = "Cust Nav Link 4"}</a>{/if} {/foreach} </div> Updated code - I think I've got it right - its still doing the repeating thing and now its repeating each link and each name 4 times
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on May 26, 2017 10:58:34 GMT -8
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on May 26, 2017 12:22:48 GMT -8
Peter - Thank you Peter! So update: I now have things sorta showing how they should be, but the links aren't working (so it's only showing up as plain text) {foreach $[current_user.custom_field]} {if $[current_user.custom_field.name] == "Cust Nav Link 1"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 1 Name"}$[current_user.custom_field.value]{/if} {if $[current_user.custom_field.name] == "Cust Nav Link 1"}</a>{/if}<br /> {if $[current_user.custom_field.name] == "Cust Nav Link 2"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 2 Name"}$[current_user.custom_field.value]{/if} {if $[current_user.custom_field.name] == "Cust Nav Link 2"}</a>{/if}<br /> {if $[current_user.custom_field.name] == "Cust Nav Link 3"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 3 Name"}$[current_user.custom_field.value]{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 3"}</a>{/if}<br /> {if $[current_user.custom_field.name] == "Cust Nav Link 4"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 4 Name"}$[current_user.custom_field.value]{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 4"}</a>{/if}<br /> {/foreach}
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on May 26, 2017 13:13:30 GMT -8
Moving the </a> to the second {if} and removing the last {if} will solve it.
{foreach $[current_user.custom_field]} {if $[current_user.custom_field.name] == "Cust Nav Link 1"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 1 Name"}$[current_user.custom_field.value]</a><br />{/if} {if $[current_user.custom_field.name] == "Cust Nav Link 2"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 2 Name"}$[current_user.custom_field.value]</a><br />{/if} {if $[current_user.custom_field.name] == "Cust Nav Link 3"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 3 Name"}$[current_user.custom_field.value]</a><br />{/if} {if $[current_user.custom_field.name] == "Cust Nav Link 4"}<a href="$[current_user.custom_field.value]">{/if}{if $[current_user.custom_field.name] == "Cust Nav Link 4 Name"}$[current_user.custom_field.value]</a><br />{/if} {/foreach}
|
|