Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Code Snippet and functions - 9

Post your code snippets and functions related to v9 here
26 posts | Last Activity on 12-11-2020 22:56 by Cupid
Cupid
Cupid 12-11-2020 22:56, 17 days ago
Re: Php basics I see. 

In the V7 of php-fusion I had my site's forums cusomized. Each site had its own forum prefix but then below it I had a shared prefix visible on all sites. 

So main site had main forums and sub sites had their own separate forums but still had the main forum visible. 
RobiNN
RobiNN 12-11-2020 21:46, 17 days ago
Re: Php basics It is generated automatically depending on which infusions you have installed. Each installed infusion has its own *_EXISTS constant. E.g. SHOUTBOX_PANEL_EXISTS, BLOG_EXISTS, NEWS_EXISTS..
Code
if (defined('BLOG_EXISTS')) {
// Content is only visible if Blog is installed.
}


We do not recommend editing core files, especially if you do not know PHP. In next update, forum will have a completely new design.
Cupid
Cupid 12-11-2020 20:58, 17 days ago
Re: Php basics So for the forum in fusion /infusions/forum/index.php confuses me. 

I want to do some editing to the forum. How does it's index.php know what to grab? What is "FORUM_EXISTS"? Where is its 'constant'?
Cupid
Cupid 12-11-2020 03:51, 17 days ago
Re: Php basics Thank you. So I assume when an infusion is installed that its constants (is that what they're called) are defined in the infusion folder?

EDIT: I think I found it. It's defined in infusion_db?
Falk
Falk 12-11-2020 03:29, 17 days ago
Re: Php basics Defined in includes/core_constants_include.php
 
Cupid
Cupid 12-11-2020 03:14, 17 days ago
Re: Php basics Just a quick question. I don't know a lot about php and I'm trying to learn. Not sure where I should post this question.

How did the php-fusion system know where to fine things that are require_one like "THEMES" "INCLUDES" "INFUSIONS", etc.

I understand where they point, but how does the system know that THEMES is in ..basdir/themes?

Thanks for any help.
symply clever
symply clever 05-10-2020 23:37, 2 months ago
Re: Css Rainbow here is an interesting css code for you who want to use it



/******************************NEW*********************/
.rainbow-text {
 animation-duration: 3.115s;
}
/*fb8532*--000000*/
/*2188ff--2846F0*/
/*ffd33d--1DB30F*/
.rainbow-text {
 background: linear-gradient(43.13deg,#ffd33d 0,#000000 90%,#ea4a5a 90%,#8a63d2 90%,#2846F0 90%,#34d058 90%,#1DB30F 100%);
 background-size: auto;
 background-clip: border-box;
 background-clip: text;
 display: inline-block;
 color: transparent;
 text-fill-color: transparent;
 -webkit-background-clip: text;
 -webkit-text-fill-color: transparent;
 animation: shine 6.28s alternate infinite;
 animation-duration: 6.28s;
 background-size: 300%;
 font-size: 30px;
}

@keyframes shine {
 0% {
  background-position:200% center
 }
 62.8% {
  background-position:100% center
 }
 100% {
  background-position:200% center
 }
}
/******************************END*********************/

Found at:https://werner-zenk.de/

Installtion so here:

echo "
Your text


thanks lg
 
Z
zizub 03-03-2020 01:29, 9 months ago
Re: Adding a button to the html editor (textarea) Button with two div's for responsive videos from YouTube and HTML5 Video
Code
 $res .= "
', '".$formname."');\">div video\n";

HTML
Code
Insert iframe YouTube or HTML5 Video here


CSS
Code
.outer-wrapper {
 width: 100%;
 max-width: 560px;
 margin: 0 0 10px;
}
.video-container {
 height: 0;
 margin: auto;
 z-index: 1;
 position: relative;
 padding-top: 25px;
 padding-bottom: 56.25%;
 display: block;
 overflow: hidden;
}
 iframe, video {
 display: block;
 top: 0;
 left: 0;
 width: 100%;
 height: 100%;
 z-index: 5;
 position: absolute;
 }


For me, this is a good solution. I need the player to not be full-width on the desktop monitor. max-width: 560px; in outer-wrapper allows me to control the size.
Z
zizub 29-02-2020 17:21, 9 months ago
Re: Adding a button to the html editor (textarea) Adding a button to the html editor (textarea) in new PHP-Fusion 9, xx. Open the file includes/html_buttons_include.php and add the code for the new button.
Sample code. Buttons that work for me in pf-9

Ul button
Code
 $res .= "', '', '".$formname."');\">\n";


Li button
Code
 $res .= "', '', '".$formname."');\">\n";


Awesome download icon for file links
Code
 $res .= "\n";


DIV block with custom css
Code
 $res .= "
', '".$formname."');\">div css\n";

YouTube button
Code
 $res .= "\n";


Instead of XXXXX, insert the id of the video. Such a video will not display well on small mobile screens.
SkeeredOfMyMind
SkeeredOfMyMind 19-10-2019 17:45, 1 year ago
Re: <script> & <div> Code in Site Banners with TinyMCE? I was not aware PHP-Fusion 9 had a built in drop down menu. Exactly where is this located? I cannot seem to find a drop down menu in PHP-Fusion 9. Can you pleas elaborate and let me know how to enable it and use it since it exists? I will not use an external menu or infusion if one is already built in.
Chan
Chan 17-10-2019 14:23, 1 year ago
Re: <script> & <div> Code in Site Banners with TinyMCE? Not sure related here but, V9 own Menu has already a Drop Down. Why would you need to go for an infusion one?

There are 2 ways extras you can do it.

1. Open up your theme.php, run the code there inside render_page() {}
2. Use Panels.

Coding:
Script tags are always to the footer with add_to_footer("");

In panels, which you can configure to place it to display on Upper section

echo "Hello World!";
?>

is accepted only if your allow php execution. It doesn't matter whether TinyMCE is on or off. TinyMCE does not affect code storage. It saves the same as common textarea input.
Chan
Chan 17-10-2019 14:17, 1 year ago
Re: Adding Color Switcher & Text Size Changer to Theme? For the sake of the quality post that users are about to give, please state:

1. Which CMS version are you using?
Different ones need different answers. V9 has cookie.js, which is part of the answer, and V7 doesn't have it.

2. The code that you have come up with now. What is your progress?

3. The Site Url that you are working on, and what environment. PHP version, MySQL version, etc.
I think I'll need to come up with a User Fields allowing users to state all these so next time, they can tag their site on forum posts.

For most of the answers, the easiest one will be, open the theme you saw in the picture and mod on it.
SkeeredOfMyMind
SkeeredOfMyMind 17-10-2019 09:33, 1 year ago
Re: Adding Color Switcher & Text Size Changer to Theme? Can someone please tell me what code to use to add a Color Switcher and a Text Size Changer to a Theme for PHP-Fusion 9 like the Theme Pastel has? I am including an image of the Pastel Theme and pointed out the Color Switcher and Text Sizer Changer I am speaking of on the top right side of the Theme.

Also, where exactly do I place the code and can the code be used with Themes/Templates that are not PHP-Fusion Themes as well or would the code be different for those Themes/Templates?

I am working on creating a new Theme and I would like to add both the Color Switcher and the Text Size Changer to the Theme I am creating along with some other cool features not found in most other PHP-Fusion Themes.

Any help with this is greatly appreciated.

i.ibb.co/WHpSknP/Pastel-Theme-Color-Switcher-Text-Size-Changer.png

SkeeredOfMyMind
SkeeredOfMyMind 17-10-2019 06:53, 1 year ago
Re: <script> & <div> Code in Site Banners with TinyMCE?

Quote

Go to Settings > Security > Allow PHP Execution - Yes.

Will it work?


Thanks for the help, but no it did not work. Now should I be pasting this code as Source Code? Keep in mind, I do have TinyMCE enabled and I do use it and need it. After I saved the code and go back, the only thing left from the code:
is this:
 


Any other ideas? I recall one time someone told me to echo the code but I forget how to do that, can someone please remind me?
Chan
Chan 15-10-2019 16:07, 1 year ago
Re: <script> & <div> Code in Site Banners with TinyMCE? Go to Settings > Security > Allow PHP Execution - Yes.

Will it work?
SkeeredOfMyMind
SkeeredOfMyMind 15-10-2019 08:29, 1 year ago
Re: <script> & <div> Code in Site Banners with TinyMCE? Since I cannot get any of the Drop Down Menu Infusions here to work for my new PHP-Fusion site (running the newest version of PHP-Fusion 9, I am trying to create my own drop down menu. It requires just a couple lines of code. I went to add it to the Site Banners and I have TinyMCE enabled but when I add the code, it gets removed and my menu does not show. I recall having this issue before but do not remember exactly what fixed it. How can I add this code:
to my Site Banners so my drop down menu will appear without disabling TinyMCE? I need TinyMCE but I also need the code to work in the Site Banners because my navigation menu is long and not very appealing.

Also, is there an alternative to TinyMCE for PHP-Fusion 9 yet that works since TinyMCE is so fussy about stuff?

If you could please write the code exactly as it should be pasted in, to work, that would be extremely helpful. All help is appreciated very much!
Grimloch
Grimloch 20-09-2019 18:22, 1 year ago
Re: Table Responsive Delima Well I finally have my first successful complete conversion of a table setup to the responsive div setup. Making progress! cool
Grimloch
Grimloch 17-09-2019 19:07, 1 year ago
Re: Table Responsive Delima Well I solved the description heading and field problem by taking it completely out of the table and putting it in a div with class='post_message'. It works fine. I need to learn more div techniques anyway.
Chan
Chan 17-09-2019 08:48, 1 year ago
Re: Table Responsive Delima The design is a bit limited for

The doc for bootstrap for a table tag is found here - https://bootstrapdocs.com/v3.3.0/docs...ss/#tables

What it does is just to add a horizontal scrollbar when screen width collapses.

[attach]attachid=2705&size=md[/attach]
Grimloch
Grimloch 16-09-2019 13:48, 1 year ago
Re: Table Responsive Delima This is a browser width of 752. If I drag the window even slightly smaller then the description field jumps back to straight across with no auto-flow:
www.whisperwillow.com/my_panels/752.jpg

I cannot figure out how to make it continue to flow left at lower widths.
You can view all discussion threads in this forum.
You can start a new discussion thread in this forum.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.