addCode2Page: random quote

Post Reply
arfa
Master Bludit
Posts: 158
Joined: Tue Jul 04, 2017 4:31 am
Location: New Zealand
Has thanked: 13 times
Been thanked: 27 times

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
1dtravel
Ssr. Bludit
Posts: 24
Joined: Sun Apr 09, 2023 5:12 pm

I accidentally updated the plugin from the archive. The addCode2Page plugin is in the /bl-plugins/addCode2Page/ folder. Now the site is not working.

What should I do to make the site work? I accidentally updated a plugin on a working site, and the site is showing an HTTP ERROR 500
arfa
Master Bludit
Posts: 158
Joined: Tue Jul 04, 2017 4:31 am
Location: New Zealand
Has thanked: 13 times
Been thanked: 27 times

as the author I am sorry to hear you are having issues.

>> updated the plugin from the archive
There have been no updates. Do you mean you activated the plugin? For the first time? Or did you add a snippet? The 'random quote' snippet? Other? As much detail on just what you did can help refine the issue.

I saw in the 'general' section your post asking about error log. I don't think Bludit has one but you can read logs using FTP. How they are presented may vary by host. Mine are error_log

cheers – Kusalo
Post Reply