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
19 posts | Last Activity on 03-03-2020 02:29 by zizub
Z
zizub 03-03-2020 02:29, 4 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 18:21, 4 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 18:45, 8 months 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.
C
Chan 17-10-2019 15:23, 9 months 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.
C
Chan 17-10-2019 15:17, 9 months 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 10:33, 9 months 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 07:53, 9 months 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?
C
Chan 15-10-2019 17:07, 9 months 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 09:29, 9 months 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 19:22, 9 months 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 20:07, 9 months 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.
C
Chan 17-09-2019 09:48, 9 months 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 14:48, 10 months 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.
Grimloch
Grimloch 16-09-2019 00:37, 10 months ago
Re: Table Responsive Delima

tocrah wrote:

@tocrah
- I would take the grid system from bootstrap. Would that be a solution for you?


Sure that would probably be a solution if I knew how to apply the coding to my infusion. I am a table person and don't use divs and really have a hard time understanding how to use divs. I suppose one day I'll figure it out if I live that long! LOL grin
tocrah
tocrah 15-09-2019 19:55, 10 months ago
Re: Table Responsive Delima I would take the grid system from bootstrap. Would that be a solution for you?
Grimloch
Grimloch 15-09-2019 19:18, 10 months ago
Re: Table Responsive Delima I know you guys must get tired of my piece-meal efforts to understand v9. I'm sorry but I need to know how to re-code things to conform to the new deal. I have tried to apply table-responsive to my infusion but this is what I'm getting. This 1st screen is full width:
www.whisperwillow.com/my_panels/fullscreen.jpg

This next image is when I reduce the screen to a smaller size to test table-responsive:
www.whisperwillow.com/my_panels/smallscreen.jpg
Notice the functional scroll-bar at the bottom.

And this is my code:
Code
            opentable($locale['INF_TITLE'].$locale['title2'].$data['book_title']);
            add_to_title($locale['title2'].$data['book_title']);
            echo "
\n";
            echo "
\n";
            echo "
\n";
            $new = "";
            if ($data['book_datestamp'] + 604800 > time() + (date_default_timezone_set($settings['default_timezone']) * 3600)) {
               $new = "".$locale['book_410']."";
            }
            echo "
\n";
            echo "
\n";
            echo "
\n";
            echo "
\n";
            echo "
\n";
            echo "
\n";
            echo "
\n";
            if ($data['book_pubdate']) {
               echo "
\n";
               echo "
\n";
               echo "
\n";
            }
            if ($data['book_publisher']) {
               echo "
\n";
               echo "
\n";
               echo "
\n";
            }
            if ($data['book_language']) {
               echo "
\n";
               echo "
\n";
               echo "
\n";
            }
            if ($data['book_format']) {
               echo "
\n";
               echo "
\n";
               echo "
\n";
            }
            echo "
\n";
            echo "
\n";
            echo "
\n";
            echo "
\n";
            echo "
\n";
            $drating = dbarray(dbquery("SELECT SUM(rating_vote) sum_rating, COUNT(rating_item_id) count_votes FROM ".DB_RATINGS." WHERE rating_item_id='".$data['book_id']."' AND rating_type='B'"));
            $num_votes = $drating['count_votes'];
            $rating = ($num_votes > 0 ? str_repeat("",ceil($drating['sum_rating']/$num_votes))." [".$locale['book_428'].": ".$num_votes."]" : $locale['book_429']);
            echo "
\n";
            echo "
\n";
            echo "
\n";
            echo "
\n";
            echo "
\n";
            if ($asettings['read_epub'] && ($data['book_format'] =="EPUB")) {
            echo "
\n";
            echo "
\n";
            } elseif ($data['book_format'] =="PDF") {
            echo "
\n";
            echo "
\n";
            } else {
            echo "
\n";
            echo "
\n";
            }
            echo "
\n";
            if ($data['book_description']) {
            echo "
\n";
            echo "
\n";
            echo "
\n";
            }
            echo "
\n";
            echo "
\n";
            echo "
".$data[\n";
            if ($asettings['social_sharing']) {
               echo "
\n";
               $link = $settings['siteurl'].str_replace("","",INFUSIONS)."booklib/book.php?book_id=".$_GET['book_id'];
               echo "Facebook \n";
               echo "Twitter \n";
               echo "Digg \n";
               echo "Reddit \n";
               echo "Del.icio.us \n";
               echo "
\n";
            }
            echo "
".$locale['book_411'].":".$data['book_title']." ".$new."
".$locale['book_417'].":".($data['book_author'] ? $data['book_author'] : "-")."
".$locale['book_413'].":".cat_parents($data['book_cat'])."
".$locale['book_419'].":".$data['book_pubdate']."
".$locale['book_415'].":".$data['book_publisher']."
".$locale['book_436'].":".$data['book_language']."
".$locale['book_438'].":".$data['book_format']."
".$locale['book_422'].":".($data['book_filesize'] ? $data['book_filesize'] : "-")."
".$locale['book_418'].":".$rating."
".$locale['book_424'].":".$locale['book_416']." [".$data['book_count']."] ".(!$can_download ? "".$locale['book_432']."" : "")."
".$locale['book_443'].":".$locale['book_439']."".$locale['book_443'].":".$locale['book_445']."".$locale['book_443'].":".$locale['book_444']."
".$locale['book_423'].":
".html_entity_decode(parseubb(parsesmileys($data['book_description'])))."
".$locale['book_433']." ".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."
".$locale['book_437']." ".showdate("shortdate", $data['book_datestamp'])."
\n";
            closetable();



Please someone help me to understand what I am doing wrong!
26-06-2019 04:11, 1 year ago
Re: Mastodon Feed
elbasy
Re: Transfer of unique visitors from the bottom to online_users_panel, added a date. Transfer of unique visitors from the bottom to online_users_panel, added a date.
Code
echo "
\n".showcounter()  .showsubdate()."
\n";

daimonbok1
daimonbok1 29-07-2017 02:40, 3 years ago
Re: Instead of using an iframe to load content into a page Found this today, easier than iframes and seem better accepted maybe?

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.