NEW - Add code to page
-
- Master Bludit
- Posts: 145
- Joined: Tue Jul 04, 2017 4:31 am
- Location: New Zealand
- Has thanked: 13 times
- Been thanked: 24 times
A shortcode system to insert code (PHP, jQuery, HTML) on individual pages.
The plugin compiles a single php variable, using your code, and swaps it with the shortcode.
This was on my list anyhow but grew as a response to this post.
viewtopic.php?p=13561&hilit=code#p13561
It is in the repository:
http://localhost/bum/admin/configure-plugin/akSnippets
This is my 2nd plugin and I am still learning Bludit so feedback is welcome. This can easily include mod suggestions - which I am happy to explore, develop, add.
Depending on take up here there is the possibility of sharing snippets. What use are you putting it to?
enjoy - Kusalo
The plugin compiles a single php variable, using your code, and swaps it with the shortcode.
This was on my list anyhow but grew as a response to this post.
viewtopic.php?p=13561&hilit=code#p13561
It is in the repository:
http://localhost/bum/admin/configure-plugin/akSnippets
This is my 2nd plugin and I am still learning Bludit so feedback is welcome. This can easily include mod suggestions - which I am happy to explore, develop, add.
Depending on take up here there is the possibility of sharing snippets. What use are you putting it to?
enjoy - Kusalo
- novafacile
- Master Bludit
- Posts: 130
- Joined: Sat Oct 06, 2018 4:47 pm
- Has thanked: 58 times
- Been thanked: 17 times
- Contact:
Thanks for this, but:
You have to publish it to github or a similar service.
This is localhost. Nobody has access to this, except you.arfa wrote: ↑Fri Feb 14, 2025 6:55 pm It is in the repository:
http://localhost/bum/admin/configure-plugin/akSnippets

You have to publish it to github or a similar service.
-
- Master Bludit
- Posts: 145
- Joined: Tue Jul 04, 2017 4:31 am
- Location: New Zealand
- Has thanked: 13 times
- Been thanked: 24 times
@novafacile
Thanks for the feedback... the URL you echoed is indeed one of my offline tests - a bum (steer).
My bad - it should read...
It is in repository: https://plugins.bludit.com/plugin/addcode2page#download
just an old brain...
thx - Kusalo
Thanks for the feedback... the URL you echoed is indeed one of my offline tests - a bum (steer).
My bad - it should read...
It is in repository: https://plugins.bludit.com/plugin/addcode2page#download
just an old brain...
thx - Kusalo
- LRAM
- Legend Bludit
- Posts: 223
- Joined: Sat Sep 24, 2016 4:02 pm
- Location: France
- Has thanked: 48 times
- Been thanked: 5 times
- Contact:
Hi
I asked claude.ia to make me a php script listing the videos in a specific directory and allowing me to read them
this script works like a charm
if I want a Bludit page to use this script, how do I proceed? how do I call the script from your plugin, I've read the example, I can't see what I need to write and where
thank you.
I asked claude.ia to make me a php script listing the videos in a specific directory and allowing me to read them
this script works like a charm
if I want a Bludit page to use this script, how do I proceed? how do I call the script from your plugin, I've read the example, I can't see what I need to write and where
thank you.
https://sucrepop.com
Candies for the ears
Candies for the ears
-
- Master Bludit
- Posts: 145
- Joined: Tue Jul 04, 2017 4:31 am
- Location: New Zealand
- Has thanked: 13 times
- Been thanked: 24 times
The plugin is for writing a variable - $snipData - to a page. Without seeing your script I am not able to say how it might best be added to $snipData. You can see in the example snippet I have used some jQuery.
You have a php script and I wonder how complex it is. It may require an ajax call and I have not tried that with addCode2Page.
>> videos in a specific directory
Is that a local directory or remote?
If the script is not too huge you can post it here and I can have a look and further share thoughts.
go well - Kusalo
You have a php script and I wonder how complex it is. It may require an ajax call and I have not tried that with addCode2Page.
>> videos in a specific directory
Is that a local directory or remote?
If the script is not too huge you can post it here and I can have a look and further share thoughts.
go well - Kusalo
- LRAM
- Legend Bludit
- Posts: 223
- Joined: Sat Sep 24, 2016 4:02 pm
- Location: France
- Has thanked: 48 times
- Been thanked: 5 times
- Contact:
Thank for the answer
it's a remote directory
Here's the script generated by Claude
it's a remote directory
Here's the script generated by Claude
- Attachments
-
- mp42.zip
- (2.49 KiB) Downloaded 157 times
https://sucrepop.com
Candies for the ears
Candies for the ears
-
- Master Bludit
- Posts: 145
- Joined: Tue Jul 04, 2017 4:31 am
- Location: New Zealand
- Has thanked: 13 times
- Been thanked: 24 times
OK - AI...? It can be useful for sure.
If you understand how code2Page works then you can do it yourself.
You have an array $videos
You need to loop through that adding to $snipData concatenating using .=
for ($i=0; $i<count($videos); $i++) {
$snipData .= '<div ???>'.$videos[$i].'</div>';
}
This is hardly complete but I hope you get the idea.
So, AI -
I asked my friend
https://kusalo.net/temp/videoSnippet.zip
In theory all you need to do copy/paste the whole php into a new snippet instance + change $directory = __DIR__;
insert your [% snip=whateverYourSnippet %] on a bludit page - Et voilà !
IMHO - Claude is too verbose. The script could be simpler.
Let me know how this goes.
kusalo
If you understand how code2Page works then you can do it yourself.
You have an array $videos
You need to loop through that adding to $snipData concatenating using .=
for ($i=0; $i<count($videos); $i++) {
$snipData .= '<div ???>'.$videos[$i].'</div>';
}
This is hardly complete but I hope you get the idea.
So, AI -
I asked my friend
And it compiled the following:can you write a complete compilation - including the php function and all. Also the css - written as a part of the $snipData .= compilation.
The aim is to have a complete code that runs and compiles $snipData - which is echoed on a web page via the plugin
https://kusalo.net/temp/videoSnippet.zip
In theory all you need to do copy/paste the whole php into a new snippet instance + change $directory = __DIR__;
insert your [% snip=whateverYourSnippet %] on a bludit page - Et voilà !
IMHO - Claude is too verbose. The script could be simpler.
Let me know how this goes.
kusalo
-
- Master Bludit
- Posts: 145
- Joined: Tue Jul 04, 2017 4:31 am
- Location: New Zealand
- Has thanked: 13 times
- Been thanked: 24 times
I had a look through the script and spotted a blip - about line 234
$snipData .= '</div>'; // .video-list
$snipData .= '</'; this line had no closing ';
total failure without.
$snipData .= '</div>'; // .video-list
$snipData .= '</'; this line had no closing ';
total failure without.