collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 375
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Author Topic: Why html Code gets truncated when embedding in a page!  (Read 9574 times)

0 Members and 1 Guest are viewing this topic.

Offline vas

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Why html Code gets truncated when embedding in a page!
« on: February 17, 2011, 04:44:47 AM »
I am using SMF2 RC4 and Simple Portal 2.3.3

I tried to use the following attached code in a Simple Portal Page  and the code gets truncated even though it allows full preview. Because of this, only half the page is produced when the page is displayed.

When you look at the code using edit, you see only half the code is saved.

Is there a limitation in Simple Portal in regard to number of lines etc.,

For your info, I am trying to use a table from Excel converted by MS-Office to HTML format

Since the code is very lengthy, I have enclosed here as attachment.

Thanks for response.
« Last Edit: February 17, 2011, 06:40:26 AM by vas »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Why html Code gets truncated when embedding in a page!
« Reply #1 on: February 17, 2011, 10:26:10 AM »
There are a couple of problems with that HTML
1) It is an entire page.
    Because an HTML block appears on a page of your forum, it should only contain the stuff that goes inside the <body> tag.  That means no <style> tags.  Anything you want between style tags, you can put in a CSS file. Of course, CSS files are loaded BEFORE the body tag. So the only way to add that CSS link in the head where it belongs from within your HTML block is by using a little javascript to do it.
 
2) It is, indeed, quite long.  Over 2000 lines. How long can the page text be? I just looked in install2.php to see that the body column of the pages table is of type text. Then I checked the mySql manual to find out that TEXT fields can hold 2^16 (=65536) characters. So that's your limit.
 
One way to get around this limit is to save your HTML to a file. Use a php block. Open the file and echo its contents to the screen.
Code: [Select]
if ( $filearray=file($FileName) )  echo implode($filearray,'');
else echo "Could not open file <b>$FileName</b>. <br /> \n";
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline vas

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Why html Code gets truncated when embedding in a page!
« Reply #2 on: February 18, 2011, 05:34:25 AM »
There are a couple of problems with that HTML
1) It is an entire page.
    Because an HTML block appears on a page of your forum, it should only contain the stuff that goes inside the <body> tag.  That means no <style> tags.  Anything you want between style tags, you can put in a CSS file. Of course, CSS files are loaded BEFORE the body tag. So the only way to add that CSS link in the head where it belongs from within your HTML block is by using a little javascript to do it.
 [/code]
Thanks for this advice.

2) It is, indeed, quite long.  Over 2000 lines. How long can the page text be? I just looked in install2.php to see that the body column of the pages table is of type text. Then I checked the mySql manual to find out that TEXT fields can hold 2^16 (=65536) characters. So that's your limit.
 
One way to get around this limit is to save your HTML to a file. Use a php block. Open the file and echo its contents to the screen.
Code: [Select]
if ( $filearray=file($FileName) )  echo implode($filearray,'');
else echo "Could not open file <b>$FileName</b>. <br /> \n";
I will implement this, see how it works and give here the feedback.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Why html Code gets truncated when embedding in a page!
« Reply #3 on: February 23, 2011, 10:06:39 AM »
Please post again when you have an update on this issue.
Thanks
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline Yngwiedis

  • Jr. Member
  • **
  • Posts: 67
  • SMF Version: None
  • SP Version: 2.3.3
Re: Why html Code gets truncated when embedding in a page!
« Reply #4 on: April 17, 2011, 12:54:26 PM »
Hello...

I have almost the same problem with vas.
I have a very large html table which i want to be displayed on a page.

I try the solution you suggest with this code:

Code: [Select]
if ( $filearray=file($FileName) )  echo implode($filearray,'');
else echo "Could not open file <b>$FileName</b>. <br /> \n";

but i get errors like this :

Code: [Select]
Parse error: syntax error, unexpected ':' in /home/xxxxx/public_html/Sources/PortalBlocks.php(3386) : eval()'d code on line 1
can you point me in the right direction ?

Thank you very much.


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Why html Code gets truncated when embedding in a page!
« Reply #5 on: April 18, 2011, 08:40:56 AM »
Sorry. This fragment was just a suggestion, not a well-tested solution.
Of course, you must say what your fileName is before you use it.

If you've already got an HTML file, maybe your easiest solution is just to use an iframe tag to include it in the page.
http://www.google.com/search?q=iframe+tag
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline Yngwiedis

  • Jr. Member
  • **
  • Posts: 67
  • SMF Version: None
  • SP Version: 2.3.3
Re: Why html Code gets truncated when embedding in a page!
« Reply #6 on: April 18, 2011, 10:44:17 AM »
I dont want to use an iframe.

The filename will be .html ?
Or something else ?

so the code will be something like this ?

Code: [Select]
if ( $filearray=myfile.html($FileName) )  echo implode($filearray,'');
else echo "Could not open file <b>$FileName</b>. <br /> \n";

Thank you very much.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Why html Code gets truncated when embedding in a page!
« Reply #7 on: April 19, 2011, 05:35:18 AM »
Run this query via phpMyAdmin:

Code: [Select]
ALTER TABLE smf_sp_pages
CHANGE COLUMN body body MEDIUMTEXT

That should increase the field limit to ~16 million characters.
And slowly, you come to realize... It's all as it should be...

Offline vas

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Why html Code gets truncated when embedding in a page!
« Reply #8 on: April 19, 2011, 07:43:43 AM »
Run this query via phpMyAdmin:

Code: [Select]
ALTER TABLE smf_sp_pages
CHANGE COLUMN body body MEDIUMTEXT

That should increase the field limit to ~16 million characters.

I will try this. Will this any way reduce the speed of loading the portal pages!?

Before I saw SiNaN message, I found a different way out.  Even though it did not fulfill what I wanted (I want the simple portal page to have a html) it served the purpose of having SMF header and footer and avoided moving out of the forum to see the html page. The solution I found is from
Creating own HTML page between SMF header and footer ??
« Last Edit: April 19, 2011, 07:46:06 AM by vas »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Why html Code gets truncated when embedding in a page!
« Reply #9 on: April 19, 2011, 08:10:17 AM »
Code: [Select]
$FileName='myfilename.html';
if ( $filearray=file($FileName) )  echo implode($filearray,'');
else echo "Could not open file <b>$FileName</b>. <br /> \n";

You can usually decrease the time to load portal pages by decreasing the number of  blocks on the page.
You can go through, one by one, to find out which ones slow things down the most.
 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Why html Code gets truncated when embedding in a page!
« Reply #10 on: April 19, 2011, 08:15:24 AM »
I will try this. Will this any way reduce the speed of loading the portal pages!?

Did you mean "increase" perhaps? I read it that way, initially.
And slowly, you come to realize... It's all as it should be...

Offline Yngwiedis

  • Jr. Member
  • **
  • Posts: 67
  • SMF Version: None
  • SP Version: 2.3.3
Re: Why html Code gets truncated when embedding in a page!
« Reply #11 on: April 19, 2011, 10:23:18 AM »
Code: [Select]
$FileName='myfilename.html';
if ( $filearray=file($FileName) )  echo implode($filearray,'');
else echo "Could not open file <b>$FileName</b>. <br /> \n";


This is not working for me.
I always get "Could not open file" error.

Offline vas

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Why html Code gets truncated when embedding in a page!
« Reply #12 on: April 19, 2011, 12:14:55 PM »
Did you mean "increase" perhaps? I read it that way, initially.

I apologize my statement was ambiguous. What I tried to mean is "Increase the field limit to ~16 million characters anyway adversely affect the speed of loading a web page?"

Will it take more time to load any (and every page) - even those which do not contain data that exceed the present field character limit, due to bigger data field in the mysql?
« Last Edit: April 20, 2011, 01:07:43 AM by vas »

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Why html Code gets truncated when embedding in a page!
« Reply #13 on: April 20, 2011, 08:17:34 AM »
This is not working for me.
I always get "Could not open file" error.

Where do you upload the HTML file, exactly?

I apologize my statement was ambiguous. What I tried to mean is "Increase the field limit to ~16 million characters anyway adversely affect the speed of loading a web page?"

Will it take more time to load any (and every page) - even those which do not contain data that exceed the present field character limit, due to bigger data field in the mysql?

No, it shouldn't slow down the page load. You may only experience issues with PHP memory limit when you have pages more than ~4-5 million characters, and that's only if you have the limit set as low as 8-16MB. So it should be fine.
And slowly, you come to realize... It's all as it should be...

Offline vas

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Why html Code gets truncated when embedding in a page!
« Reply #14 on: April 21, 2011, 02:00:19 AM »
No, it shouldn't slow down the page load. You may only experience issues with PHP memory limit when you have pages more than ~4-5 million characters, and that's only if you have the limit set as low as 8-16MB. So it should be fine.

Thanks for the information.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Why html Code gets truncated when embedding in a page!
« Reply #15 on: April 21, 2011, 04:58:05 AM »
So did that solve your issue?
And slowly, you come to realize... It's all as it should be...

Offline allison

  • Semi Newbie
  • *
  • Posts: 9
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Why html Code gets truncated when embedding in a page!
« Reply #16 on: April 23, 2011, 05:39:03 AM »
nvm - changed the name and its working.
Thanks
« Last Edit: April 23, 2011, 05:46:39 AM by allison »

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Why html Code gets truncated when embedding in a page!
« Reply #17 on: April 24, 2011, 07:50:43 AM »
Glad that it worked for you.
And slowly, you come to realize... It's all as it should be...

Offline vas

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Why html Code gets truncated when embedding in a page!
« Reply #18 on: April 25, 2011, 07:42:02 AM »
So did that solve your issue?
Thanks for your help SiNaN. It worked. The issue is solved using the code you provided.

Quote
Run this query via phpMyAdmin:

Code: [Select]
ALTER TABLE smf_sp_pages
CHANGE COLUMN body body MEDIUMTEXT

Thanks once again. :applause:

One follow up query: Before it being converted to MEDIUMTEXT what the field type was. Just Curious.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Why html Code gets truncated when embedding in a page!
« Reply #19 on: April 25, 2011, 09:06:46 AM »
You're welcome.

The field type is TEXT by default, which is limited to 65535 characters.
And slowly, you come to realize... It's all as it should be...