Support

Home Forums Event Espresso Premium EE_ANWSER shortcode problem

EE_ANWSER shortcode problem

Posted: February 28, 2014 at 3:30 pm

Viewing 5 reply threads


Sylvain Asselin

February 28, 2014 at 3:30 pm

I am trying to display the answer to a custom question using EE_ANSWER shortcode but I am struggling with a problem that I can’t figure out.

If i use this code defining the attendee id, it works fine.
$attid = ‘[att_id]’;
$custom_question_1 = do_shortcode(‘[EE_ANSWER q=”11″ a=”25″]’);
echo $custom_question_1;

But then if I try to use this code it returns this : “]
$attid = ‘[att_id]’;
$custom_question_1 = do_shortcode(‘[EE_ANSWER q=”11″ a=”‘.$attid.'”]’);
echo $custom_question_1;

I have tried many different combinations. They either not work or return the same.

Thanks!


Josh

  • Support Staff

February 28, 2014 at 4:12 pm

Hi there,

It’s kind of hard to tell from the code you posted, but it may be the mixed single and double quotes. Can you post the code, in the content of the files you’re working on in a pastebin and link to it from here so we can get a clear look?


Sylvain Asselin

February 28, 2014 at 7:19 pm

I copied the line of code form attendee_list.php (line 87) and I am using it in badge-sm.php. I am not sure of what you are asking but here is the complete code, hope this works:
<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”><?php
global $org_options;

//Build the path to the css files
if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . "tickets/templates/css/base.css")) {
$base_dir = EVENT_ESPRESSO_UPLOAD_URL . 'tickets/templates/css/';//If the template files have been moved to the uploads folder
} else {
$base_dir = ESPRESSO_TICKETING_FULL_URL.'templates/css/';//Default location
}

//Output the $data (array) variable that contains the attendee information and ticket settings
//echo "".print_r($data,true)."";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
<html>
<head>
<title><?php echo stripslashes_deep($org_options['organization']) ?> <?php _e('Ticket for', 'event_espresso'); ?> <?php echo stripslashes_deep($data->attendee->fname . ' ' .$data->attendee->lname) ?> | <?php echo $data->attendee->registration_id ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!– Base Stylesheet do not change or remove –>
<link rel="stylesheet" type="text/css" href="<?php echo $base_dir; ?>base.css" media="screen" />

<!– Primary Style Sheet –>
<link rel="stylesheet" type="text/css" href="<?php echo ESPRESSO_TICKETING_FULL_URL . 'templates/extra/sommet-vs.css'; ?>" />
<!– Google Font –>
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700&#039; rel='stylesheet' type='text/css'>

<!– Make sure the buttons don't print –>
<style type="text/css">
@media print{
.noPrint{display:none!important;}
}
</style>
</head>
<body>
<div class="outside">
<div class="print_button_div">
<form>
<input class="print_button noPrint" type="button" value=" <?php _e( 'Imprimer le billet', 'event_espresso' ); ?> " onclick="window.print();return false;" />
</form>
<form method="post" action="<?php echo espresso_ticket_url($data->attendee->id, $data->attendee->registration_id, '&pdf=true'); ?>" >
<input class="print_button noPrint" type="submit" value=" <?php _e( 'Téléchargez en format PDF', 'event_espresso' ); ?> " />
</form>
</div><br/>
<div class="instructions"><?php _e( 'Imprimez ce billet et apportez-le avec vous le jour du sommet.','event_espresso' ); ?></div>
<div class="badge">
<table class="badge-top" border="0">
<tr>
<td class="logo" valign="middle">

</td>
<td class="gravatar" valign="middle">

</td>
</tr>
</table>
<table class="badge-bottom" border="0">
<tr>
<td class="qr" valign="middle">
[qr_code]
</td>
<td class="attendee-info" valign="top" width="160" align="right">
<span class="attendee-name">[fname] [lname]</span><br><br>
<span class="attendee-company">
<?php
$attid = '[att_id]';
$custom_question_1 = do_shortcode('[EE_ANSWER q="11" a="'.$attid.'"]');
echo $custom_question_1 . '<br>';
echo $attid;
?></span><br>
<span class="attendee-company">[co_city]</span><br><br>
[registration_id]-[att_id]
</td>
</tr>
</table>
</div>
<div class="divider"></div>
<div class="extra_info">
<table width="650" border="0">
<tr>
<td class="attendee" align="left" valign="top">
<div class="info-title"><?php _e( 'Ticket information', 'event_espresso' ); ?></div>
<p>
<span class="attendee-name">[fname] [lname]</span><br>(<?php _e( 'ID:', 'event_espresso' ); ?> [att_id])</p>
<p>
[registration_id]
</p><br>
<p>
[event_name]<br>
<?php _e( 'Nombre de billets:', 'event_espresso' ); ?> [ticket_qty]<br>
<div class="price">[cost]</div>
</p>
<p>
[qr_code]
</p>
</td>
<td class="venue" align="left" valign="top">
<p>
<div class="info-title"><?php _e( 'Important', 'event_espresso' ); ?></div>
</p>
<p>
[ticket_content]
</p>
<p>
<div class="info-title">[venue_title]</div><br>
[venue_address] [venue_address2]<br>
[venue_city], [venue_state]<br>
[venue_phone]<br>
[venue_description]
</p>
</td>
</tr>
</table>
</div><br><br>
</div>
</body>
</html>


Sylvain Asselin

February 28, 2014 at 7:23 pm

Sorry I see my comment makes no sense now that I posted it but I can’t find any way to edit or remove. Here is a link to the code: http://pastebin.com/QzH3qeQ1

Thanks!


Josh

  • Support Staff

February 28, 2014 at 7:38 pm

Hi Sylvain,

It turns out that the ticketing template has its own answer shortcode. Here are a few usage examples from the documentation:

[answer_A bunch of stuff]

[answer_This is a question]

[answer_Use any custom question you like]

Basically you type square bracket answer_The Question end square bracket and it will display the answer to the question from the registration form.

More ticketing template tags info here:

https://eventespresso.com/wiki/espresso-ticketing/#template-tags


Sylvain Asselin

February 28, 2014 at 8:12 pm

It works! And so easy too…Thanks a lot!

Viewing 5 reply threads

The support post ‘EE_ANWSER shortcode problem’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso