Page 1 of 1

addCode2Page: random quote

Posted: Mon May 05, 2025 11:30 pm
by arfa
Another snippet for my plugin:
https://plugins.bludit.com/plugin/addcode2page

It will need some customisation - most importantly a file with your quotes in.
The code itself is pretty basic but I imagine you will want/need to adjust paths and css.

It looks something like this (with your text :)

Image


I hope that this might be useful for some of you.

Code: Select all

<?php
// RANDOM QUOTES
         $delimiter = "%%";
    @$all_in = file_get_contents("otherFiles/dhpad.txt", true) or die("Failed to open quote file");
    $quote = explode("$delimiter",$all_in); 
    $how_many = (count($quote))-1;
    $picker = mt_rand(1, $how_many); 
    $verse = ($picker + 2);

$snipData = "<div style='position: relative;  padding-left: 22px;'>
    <img src='bl-plugins/addCode2Page/codes/otherFiles/q_left.png' style='max-width:25px; max-height:19px; position: absolute; top:-8px; left:-4px;  max-width: 100%;'>";

$snipData .= "<div style='position: relative;'>$quote[$picker] 
    <img src='bl-plugins/addCode2Page/codes/otherFiles/q_rite.png' style='max-width:25px; max-height:19px; position: relative; top:4px; left: 2px;'></div>
			</div>
		<div style='padding:6px'><B>Dhammapada: <I>Verse $verse</I></B></div>";
?>
best - Kusalo