SimplePortal
Support => English Support => Topic started by: vas 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.
-
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.
if ( $filearray=file($FileName) ) echo implode($filearray,'');
else echo "Could not open file <b>$FileName</b>. <br /> \n";
-
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.
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.
-
Please post again when you have an update on this issue.
Thanks
-
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:
if ( $filearray=file($FileName) ) echo implode($filearray,'');
else echo "Could not open file <b>$FileName</b>. <br /> \n";
but i get errors like this :
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.
-
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
-
I dont want to use an iframe.
The filename will be .html ?
Or something else ?
so the code will be something like this ?
if ( $filearray=myfile.html($FileName) ) echo implode($filearray,'');
else echo "Could not open file <b>$FileName</b>. <br /> \n";
Thank you very much.
-
Run this query via phpMyAdmin:
ALTER TABLE smf_sp_pages
CHANGE COLUMN body body MEDIUMTEXT
That should increase the field limit to ~16 million characters.
-
Run this query via phpMyAdmin:
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 ?? (http://www.simplemachines.org/community/index.php?topic=333243.0)
-
$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.
-
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.
-
$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.
-
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?
-
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.
-
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.
-
So did that solve your issue?
-
nvm - changed the name and its working.
Thanks
-
Glad that it worked for you.
-
So did that solve your issue?
Thanks for your help SiNaN. It worked. The issue is solved using the code you provided.
Run this query via phpMyAdmin:
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.
-
You're welcome.
The field type is TEXT by default, which is limited to 65535 characters.