Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
ChrisTERiS Posted August 21, 2019 Posted August 21, 2019 Hello, I've added some custom fields in a 3nd party plugin. Using {{var_dump($video->cfields());exit;}} in the template I'm getting the array elements and values, all correct. array(6) { [0]=> array(3) { ["key"]=> int(1) ["value"]=> string(41) "Visit Club|https://www.diziask.com/clubs/" ["format"]=> string(0) "" } [1]=> array(3) { ["key"]=> int(2) ["value"]=> string(44) "Buy Subtitles|https://www.diziask.com/store/" ["format"]=> string(0) "" } [2]=> array(3) { ["key"]=> int(3) ["value"]=> string(2934) " MV5BYjYyZmE3M2YtZTcyMC00ZWU4LWE1N2UtYzE2NTk1NmViNjYyXkEyXkFqcGdeQXVyOTQ1Mzg0Mzg@._V1_.jpg MV5BYWE0ZjhlZDctMjZiMy00MzlhLWFiNTgtNGEyOGFhZDQzZjk5XkEyXkFqcGdeQXVyOTQ1Mzg0Mzg@._V1_.jpg MV5BZjg2Njc2ZTQtZTY3Yi00Nzk0LTljOGUtMzVjZDJkN2UyY2Y2XkEyXkFqcGdeQXVyOTQ1Mzg0Mzg@._V1_.jpg MV5BZTYyZWNmNzctM2JhMS00NjBmLTgxNDMtMTg0YTQ4ZWQ2NWQ5XkEyXkFqcGdeQXVyOTQ1Mzg0Mzg@._V1_.jpg " ["format"]=> string(0) "" } [3]=> array(3) { ["key"]=> int(4) ["value"]=> string(24) " https://www.treiler.com" ["format"]=> string(0) "" } [4]=> array(3) { ["key"]=> int(5) ["value"]=> string(22) " https://www.music.com" ["format"]=> string(0) "" } [5]=> array(3) { ["key"]=> int(6) ["value"]=> string(29) " https://www.kameraarkasi.com" ["format"]=> string(0) "" } } My question is how I can show only the value of the 3nd element. I tried many ways, some was showing nothing, some others can't completed as I was getting "Broken PHP code" when tried to save the template. Any help will be highly appreciated. Thank you Chris
Ryan Ashbrook Posted August 21, 2019 Posted August 21, 2019 I assume you mean the "value" item of the 3rd array entry? {$array[3]['value']} Or do you mean the third item ("value") of every entry? {{foreach $array AS $row}} {$row['value']} {{endforeach}}
ChrisTERiS Posted August 21, 2019 Author Posted August 21, 2019 3 minutes ago, Ryan Ashbrook said: I assume you mean the "value" item of the 3rd array entry? {$array[3]['value']} Or do you mean the third item ("value") of every entry? {{foreach $array AS $row}} {$row['value']} {{endforeach}} I meant the first, and thank you so much for your prompt attention to help me. Running to my site to test it 🙂
ChrisTERiS Posted August 21, 2019 Author Posted August 21, 2019 Tried this but can't save as I'm getting error for broken PHP code: {$video->cfields()->[3]['value']} also tried with: {{$video->cfields()->[3]['value']}} final try was: Quote {$video->cfields()[3]['value']} Nothing at all 😞
bfarber Posted August 22, 2019 Posted August 22, 2019 {$video->cfields()[3]['value']} This should do it - I'm unsure why this wouldn't output anything based on what you've mentioned. You could also try something like {{$fields = $video->cfields();}} {$fields[3]['value']}
Recommended Posts
Archived
This topic is now archived and is closed to further replies.