Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Bulk insert for links
Thanks. I missed this bit in the doc :/
The fist part is pretty much done: I can retrieve the content of my textarea, parse it as CSV and do my bulk insert and get back the IDs of the links.
Now, I want to append <txp:linkist ... /> the the Body inside the write panel.
I tried to append it directly to the $_POST['Body'] but if I understand correctly, the plugin is called after the save.
How could I achieve that ?
Other question: as these links are references for the article, I’d like them to be footnotes.
Below is the block I want to append to the body.
h3(ref-links). Références
<txp:variable name="linkids" value="1,2,3"/>
<txp:linklist id="1,2,3"
sort='FIELD(id, <txp:variable name="linkids" breakby="," escape="trim, quote" break="," />)'
break="br" escape="textile">
fn<txp:variable name="note_nbr" add="1" escape="tidy" output />. %(type-date)<txp:jcr_link_custom name="type_publication" /><txp:jcr_link_custom name="date_publication" />%
<txp:jcr_link_custom name="auteur" wraptag="span" class="auteur"/>
<txp:link_description wraptag="span" class="title-description"/>
<txp:link_name wraptag="span" class="éditeur-publication"/>
<a class="ref-link" href="<txp:link_url />">
voir lien
</a>
</txp:linklist>
All is fine except that the fn<x>. part is not parsed by textile to become a footnote link.
Is it even possible to do that ?
And last but least: what is the magical incantation to syntax-colour a textpattern bc.. :)
Last edited by planeth (2024-08-30 12:46:34)
Offline
Re: Bulk insert for links
planeth wrote #337752:
Other question: as these links are references for the article, I’d like them to be footnotes.
Below is the block I want to append to the body.
h3(ref-links). Références...All is fine except that the
fn<x>.part is not parsed by textile to become a footnote link.
Is it even possible to do that ?
These fn#. tokens must start a line, so escape="trim, textile" should work.
And last but least: what is the magical incantation to syntax-colour a textpattern bc.. :)
bc.. txp perhaps?
Unrelated, but break="br" and quoting link ids do not seem necessary here.
Offline
Re: Bulk insert for links
Almost there !
escape="trim, textile" plus you need break="p" to generate the footnote’s id.
The snag is that while the footnote’s id is generated, it does not matches the href link generated for the content above
Below, an example :
<p>some content<sup class="footnote" id="fnrev3292214966d1c053e5360-1"><a href="#fn3292214966d1c053e5360-1">1</a></sup></p>
<p class="footnote" id="fn128403068966d1c128ad080-1"><sup>1</sup>
here goes the footnote content
</p>
Offline
Re: Bulk insert for links
Thanks Oleg and Stef !
I’ve found that the textiled footnote works if I append directly the footnote content to the Body:
fn1. %(type)article 2019%, %(auteur)somebody%, %(title-description)Some description%, %(éditeur-publication)editor%
<a class=refLink href="http://somelink" data-link-id=98>Voir le lien</a>
The plugin run before article_save does its things.
To update the body and clear the reference_links field use
$response[] = '$("#body").val("'.escape_js($_POST['Body']).'").css("overflow", "auto")';
$response[] = '$("#plh-reference-links").val("")';
send_script_response(join("\n", $response));
If anyone is interested in the code, let me know ;)
edited for future reference
Last edited by planeth (2024-09-03 10:03:15)
Offline
Re: Bulk insert for links
Glad you have nailed it. What callback are you using? We have recently introduced two ‘pre-save’ callbacks in dev, but, probably, they are not really needed?
Offline