Segment trouble
Posted: 10 October 2010 10:40 PM   [ Ignore ]
Circled in the Yearbook
RankRankRank
Total Posts:  702
Joined  2010-04-08

Hi Rob, I’ve got a safecracker form inside an if_segment pair, yet when the if_segment if false I’m getting a The specified channel is invalid error. Looks like exp:safecracker is ignoring the if_segment.

What do you reckon?

{if segment_5 != "" AND segment_6 == ""}
{exp:safecracker channel="{segment_3}” return=”/forum/new-forum-topic/success/{segment_3}” safecracker_head=“no”}

Profile
 
 
Posted: 12 October 2010 07:56 PM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

This is a problem with EE’s advanced conditionals. The tagdata within your conditional gets parsed, no matter what. Then, at the end, that parsed tagdata will get removed depending on the results of the conditional. Two potential solutions: a) use PHP on input and build your conditionals that way

<?php if ($this->EE->uri->segment(5) && ! $this->EE->uri->segment(6)) : ?>
{exp
:safecracker channel="{segment_3}" return="/forum/new-forum-topic/success/{segment_3}" safecracker_head="no"}
<?php 
else : ?>
blah blah
<?php 
endif; ?> 

Or, b) use embeds

{if segment_5 != â??â? AND segment_6 == â??â?}
{embed
="safecracker/safecracker" channel="{segment_3}"
Profile
 
 
Posted: 13 October 2010 09:22 PM   [ Ignore ]   [ # 2 ]
Circled in the Yearbook
RankRankRank
Total Posts:  702
Joined  2010-04-08

Yes of course - - thanks for the code smile

Profile