Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [Robert] Regex for dl/dt/dd or table

Quote Reply
Re: [Robert] Regex for dl/dt/dd or table In reply to
Hi,

I would try adding it into a plugin. Do you have ULTRAGlobals installed? If so, open that up (admin/Plugins/ULTRAGlobals.pm), and then near the bottom (BEFORE the last line - 1; ), add in:

Code:
sub do_markup_table {
$_[0] =~ s{\[t\](.*)\[\/t\]}{do_table($1)}segm;
return $_[0];
}

sub do_table {

my @vals;
foreach (split /\n/, $_[0]) {
chomp;
next if length $_ < 1;
my ($day,$times) = split /:/, $_;
push @vals, qq|
<tr>
<td>$day</td>
<td>$times</td>
</tr>\n|
}

return qq|<table>| . join("",@vals) . qq|</table>|;
}

Then call from your template with:

Code:
<%Plugins::ULTRAGlobals::do_markup_table($Description)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Regex for dl/dt/dd or table Robert 7453 Dec 4, 2017, 8:34 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 7349 Dec 5, 2017, 12:23 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 7339 Dec 5, 2017, 3:00 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 7335 Dec 5, 2017, 4:15 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 7333 Dec 5, 2017, 6:11 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 7329 Dec 5, 2017, 7:03 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 7318 Dec 5, 2017, 2:35 PM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 7303 Dec 5, 2017, 11:58 PM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 7249 Dec 7, 2017, 4:19 AM
Thread Re: [Robert] Regex for dl/dt/dd or table
Andy 7238 Dec 7, 2017, 10:45 AM
Thread Re: [Andy] Regex for dl/dt/dd or table
Robert 7239 Dec 7, 2017, 11:14 AM
Post Re: [Robert] Regex for dl/dt/dd or table
Robert 7222 Dec 7, 2017, 12:21 PM