how 2 diplay the news id in news article deatail content??
i.e if id is 65 dispay: "ID: 65"
thanks
MAP
how 2 display the news id in news detail content??
Re: how 2 display the news id in news detail content??
A good way to see what's available in something like a news detail template is to print_r the variable in your template, e.g. add this line to the top:
This tells us that will output the ID.
Code: Select all
<pre>{$entry|print_r}</pre>
Code: Select all
{$entry->id}
Not getting the answer you need? CMSMS support options
Re: how 2 display the news id in news detail content??
The ID call using {$entry->id} works proper - perfect!!!
May i ask if there is also a way to insert this unique news ID automaticly in a formbuilder form - called in the news detail template .
I use this form as a request form for this specific news...?? The automatic insertion into the formbuilder form would facilitate the request and avoid errors.
I set up a UDT and insert: $entry->id; -- then i called this udt in formbuilder as a UDT field - but the result is empty
Thx
MAP
May i ask if there is also a way to insert this unique news ID automaticly in a formbuilder form - called in the news detail template .
I use this form as a request form for this specific news...?? The automatic insertion into the formbuilder form would facilitate the request and avoid errors.
I set up a UDT and insert: $entry->id; -- then i called this udt in formbuilder as a UDT field - but the result is empty
Thx
MAP
Last edited by map_1961 on Sat Nov 30, 2024 6:22 pm, edited 1 time in total.
Re: how 2 display the news id in news detail content??
Look under the Advanced tab in the Formbuilder help, it tells you how to pass a default value to a form. Essentially, you would have a hidden (or not) field in your form, and the call would be something like:
Code: Select all
{FormBuilder form='my_form' value_myfieldname='$entry->id'}
Not getting the answer you need? CMSMS support options
Re: how 2 display the news id in news detail content??
Calling this tag {FormBuilder form='my_form' value_myfieldname='$entry->id'} into formbuilder confirmation template results in an page error.
I lik to gt the news id result nto the form or into the confirmation after sending.
THX
MAP
I lik to gt the news id result nto the form or into the confirmation after sending.
THX
MAP
Re: how 2 display the news id in news detail content??
I think you've misunderstood a fair bit here. I'll try to break it down, but make sure to also read the documentation I suggested.
The value_myfieldname='$entry->id' parameter goes into your initial FormBuilder tag. The myfieldname part gets changed to the name of your field (usually a hidden field within your form). By adding this parameter, it will set the default value of that field to the value of $entry->id
You don't call FormBuilder a second time, especially from your submission template. By setting the value of this hidden field, you'll have it as a variable to use in your submission template, email templates, etc., just as if the visitor had entered that value into a field.
The value_myfieldname='$entry->id' parameter goes into your initial FormBuilder tag. The myfieldname part gets changed to the name of your field (usually a hidden field within your form). By adding this parameter, it will set the default value of that field to the value of $entry->id
You don't call FormBuilder a second time, especially from your submission template. By setting the value of this hidden field, you'll have it as a variable to use in your submission template, email templates, etc., just as if the visitor had entered that value into a field.
Not getting the answer you need? CMSMS support options