Post by michelev » Thu Jul 18, 2019 6:40 pm

Hi,
would it be possible (perhaps with some extension) to type in admin's html controls some placeholders text, something like

Code: Select all

[myCustomPlaceholder]
to being replaced at render time with some other html code snippet elsewhere defined?
This would be very useful to insert in products descriptions recurring html blocks.
Thanks
Last edited by michelev on Thu Jul 18, 2019 9:43 pm, edited 1 time in total.

Newbie

Posts

Joined
Tue Dec 05, 2017 10:56 pm

Post by letxobnav » Thu Jul 18, 2019 8:17 pm

you could try something like this in your product controller:

Code: Select all

	preg_match_all('/<replace [^>]+>/i', $data['description'], $result);
	foreach($result[0] as $replacement) {
		$file = str_replace(array('<replace file="','">'),'',$replacement);
		ob_start();
		include_once(DIR_INCLUDES . $file);
		$include_data = ob_get_clean();
		$data['description'] = str_replace('<replace file="'.$file.'"></replace>',$include_data,$data['description']);
	}


add in your product description <replace file="your_replace_file1"></replace> and <replace file="your_replace_file2"></replace>, etc.
and put the your_replace_file1 and your_replace_file2 in your DIR_INCLUDES directory

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by michelev » Fri Jul 19, 2019 3:23 pm

Thank you! Very good idea, i've adapted it with a vqmod.

Newbie

Posts

Joined
Tue Dec 05, 2017 10:56 pm
Who is online

Users browsing this forum: No registered users and 17 guests