SimplePortal
Customization => Blocks and Modifications => Topic started by: Chen Zhen on September 07, 2012, 09:32:43 PM
-
[Block] Advanced Unread Posts
Currently for SMF 2.0x only.
Features/specifics:
- View unread posts/topics
- Uses javascript pages
- Option to enable auto refresh & time interval
- Various settings available at top of block code
Download the attached file and install it via your package manager.
Place the following code in a custom php block:
Custom PHP block (Block Permissions ~ Members:
/* Unread Posts Block v1.4 || c/o Underdog @ http://askususaquestion.net */
global $settings, $sourcedir;
@require_once($sourcedir . '/PortalUnread.php');
/* Current default settings are for a full display example */
/* Recommended settings for compact display (ie. side block) : */
/* $parameters['container_style'] = 'font-family:Helvetica;font-size:10px; */
/* $parameters['display'] = 'compact'; */
/* --------------------------------------------BLOCK SETTINGS-------------------------------------------- */
$seconds = 60;
$auto_refresh = true; /* Change to false to disable auto refresh */
/* Basic settings */
$parameters['type'] = 'Posts'; /* Posts/Topics */
$parameters['rows'] = '5'; /* (int) Amount of posts/topics per page */
$parameters['display'] = 'full'; /* full/compact */
$parameters['show_icon'] = 'yes'; /* yes/no - Show new icon */
$parameters['full_height'] = 35; /* (int) Uniform row height for full display */
$parameters['compact_height'] = 45; /* (int) Uniform row height for compact display */
$parameters['container_class'] = 'mediumtext'; /* Set the css class for the whole container .. */
$parameters['container_style'] = 'font-family:Helvetica;font-size:12px;'; /* Set the css attributes for the whole container */
// $parameters['boards'] = '1|2|3|4'; /* Specific boards to display ... uncomment to use this option! */
/* This is the number of recent topics to select new one's from */
$parameters['limit'] = 30; /* (int) Maximum amount of posts/topics to display */
/* Image/Language Text ... set $parameters['unread_icons'] = false; to disable images & use text */
/* All images located in directory /Themes/default/images/sp */
$parameters['unread_icons'] = true;
$parameters['prev'] = 'Prev';
$parameters['next'] = 'Next';
$parameters['vbar_x'] = '|';
$parameters['vbar_y'] = '|';
/* Starting page */
$_SESSION['sp_current_page'] = 1;
/* --------------------------------------------END BLOCK SETTINGS-------------------------------------------- */
/* Execute & then let jQuery reset the container every xx milliseconds */
sportal_unread($parameters, false, false);
if ($auto_refresh)
echo '<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.3.2.min.js"></script>
<script type="text/javascript">
setInterval(function() {
$("#sp_content").load(location.href+" #sp_content","");
event.stopPropagation();
}, '.((int)$seconds * 1000).');
</script>';
Enjoy.
[Last Update] -> Version 1.4 Jan.22/2013
-
Thanks, Give it a try when I have time...
-
how to aply for topics?
fthkynr,
If you look at the beginning of the block code you will see where there are various possible adjustments.
For your request, specifically:
$parameters['type'] = 'Posts'; /* Posts/Topics */
Change to:
$parameters['type'] = 'Topics'; /* Posts/Topics */
-
thanks
-
Is there a way to change the mouse pointer from being the "text select" pointer to the "link select" pointer when someone hovers over the page numbers?
-
[Block] Unread Posts v1.2
Changes:
! fixed css for page numbers
The file in the first post has been updated. Please replace your current file with the newer attachment to apply the above update.
Thank you.
-
A very nice mod in deed, thanks ...
Is it possible to exclude some categories or even include categories ?
-
A very nice mod in deed, thanks ...
Is it possible to exclude some categories or even include categories ?
teos,
You can opt specific boards to display by adding another parameter to the block's basic settings. Board id's are separated by vertical bars.
$parameters['boards'] = '1|2|3|4'; /* Specific boards to display */
-
That is great, thanks. I'll give it a try.
-
Is it a difficult task to automate this block with a time interval, to be refreshed ?
tried with the solution provided in http://simpleportal.net/index.php?topic=11407.0
used code at the top
$page = $_SERVER['PHP_SELF'];
$sec = "30";
and below code at the buttom
header("Refresh: $sec; url=$page");
But this solution refreshed the whole page not inside the block.
Any recommendation ?
-
[Block] Unread Posts v1.3
Changes:
+ jquery auto refresh (if opted in block)
+ installer for needed files
teos,
The new update includes the feature you requested.
-
Most ever wanted mod, thumbs up !
A minor issue though ...
What I've done .. Since there is no uninstall function of previous mod, I directly downloaded the 1.3 files and put into production.
$parameters['rows'] = '5' is set, but it displays the whole unreads in one go.
Sometimes after the third page, sometimes in the first page. ( Tested in different browsers)
Maybe a clear cache is needed.
Am I missing sonething ?
"$parameters['full_height'] = 35;
$parameters['compact_height'] = 45
Noted that numbers do not have single queotes, is that the issue ?
Seems not, I coded single codes this time it failed on the fifth try, returned to full display.
Hımm.. Full display happens when the threshold is reached for the refresh.
Hımmm 2 ftp'ed portalunread.php to local disk and seen that it is V1.2
extracted portalunread.php from 1.3 package and replaced it in the server.
the result is the same. Full page is displayed after the threshold reached.
nb. I have also shoutbox enabled in the same page for 60secs refresh. Any effect ?
-
teos,
The js pages & refresh must be conflicting somehow. I will have to run some tests & attempt to adjust the js to get it to work properly when time permits.
To have the block function as before until I resolve & update the issue involves editing one variable..
$auto_refresh = false;
-
Thanks for your efforts. I will wait the solution deadly :-) Everybody want to use it, very handy.
-
Another minor issue, maybe related with utf8 , image attached. (undefined characters before "prev" end after "next" )
-
[Block] Unread Posts v1.4
Changes:
! fixed block height (calculated by number of rows)
! js page controller in different container (id)
+ added images for previous, next & vertical bar
+ mouseover effect for new images/buttons
teos,
Please try out v1.4 & let me know if it functions properly.
General notes:
- I attempted to apply many different jQuery commands to render the table as needed without success :ill:
- However after messing with the css, html & javascript I was able to have it display the desired effect.
- The jQuery used for reloading just the container works fairly well (perfectly for php.. not 100% expected behavior for javascript within the loaded container).
- Next update: replace javascript pagination with php routine that uses jQuery to control a container id. url & $_REQUEST should be able to pass starting key of array (page#) or use jQuery to force it in url (on partial reload)
-
Dumb question likely... but do we install BOTH files from the first page or just the larger one (ADV)?
-
There are two versions 1.3 and 1.4 - install one of them.
-
FrizzleFried,
I omitted v1.3 to thwart confusion as v1.4 appears to work correctly for the top 5 browsers.
Forum admins may need to tweak the block's settings due to the css for specific themes as I only tested this with the default theme & 2011 theme. The first post has had the block code updated with clearer comments to help with adjusting its settings for those that are less savvy.
-
Tested for several days, unfortunately refresh is not taking place. Tried with different browsers ( chrome, opera, firefox ).
The rest is functioning properly, paging etc but refresh is still an issue, from my end.
smf 2.0.3 default theme curve simple portal 2.3.5
-
teos,
I have tested this both live & locally to find that it functions as intended. Atm I am not able to duplicate your issue. Are you using the block from the first post without edits? If you adjusted its settings please post it in a code block (in its entirety). Thanks.
There is one issue where when the user is logged out due to being idle (or otherwise) the block goes blank. This is because I forgot to put some logic within the container itself that checks if it's a guest.. I will adjust this within the next week & release another version.
-
Again tested with different browsers ( Chrome, Opera, Firefox) , and different users, cleared cache.
The result for refresh is negative.
The code I use is below:
/* Unread Posts Block v1.4 || c/o Underdog @ http://askususaquestion.net */
global $settings, $sourcedir;
@require_once($sourcedir . '/PortalUnread.php');
/* Current default settings are for a full display example */
/* Recommended settings for compact display (ie. side block) : */
/* $parameters['container_style'] = 'font-family:Helvetica;font-size:10px; */
/* $parameters['display'] = 'compact'; */
/* --------------------------------------------BLOCK SETTINGS-------------------------------------------- */
$seconds = 60;
$auto_refresh = true; /* Change to false to disable auto refresh */
/* Basic settings */
$parameters['type'] = 'Topics'; /* Posts/Topics */
$parameters['rows'] = '5'; /* (int) Amount of posts/topics per page */
$parameters['display'] = 'full'; /* full/compact */
$parameters['show_icon'] = 'yes'; /* yes/no - Show new icon */
$parameters['full_height'] = 35; /* (int) Uniform row height for full display */
$parameters['compact_height'] = 45; /* (int) Uniform row height for compact display */
$parameters['container_class'] = 'mediumtext'; /* Set the css class for the whole container .. */
$parameters['container_style'] = 'font-family:Helvetica;font-size:12px;'; /* Set the css attributes for the whole container */
// $parameters['boards'] = '1|2|3|4'; /* Specific boards to display ... uncomment to use this option! */
/* This is the number of recent topics to select new one's from */
$parameters['limit'] = 30; /* (int) Maximum amount of posts/topics to display */
/* Image/Language Text ... set $parameters['unread_icons'] = false; to disable images & use text */
/* All images located in directory /Themes/default/images/sp */
$parameters['unread_icons'] = true;
$parameters['prev'] = 'Önceki sayfa';
$parameters['next'] = 'Sonraki sayfa';
$parameters['vbar_x'] = '|';
$parameters['vbar_y'] = '|';
/* Starting page */
$_SESSION['sp_current_page'] = 1;
/* --------------------------------------------END BLOCK SETTINGS-------------------------------------------- */
/* Execute & then let jQuery reset the container every xx milliseconds */
sportal_unread($parameters, false, false);
if ($auto_refresh)
echo '<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.3.2.min.js"></script>
<script type="text/javascript">
setInterval(function() {
$("#sp_content").load(location.href+" #sp_content","");
event.stopPropagation();
}, '.((int)$seconds * 1000).');
</script>';
My portalblocks.php attached.
shoutbox is enabled and refresh is set to 60sec
-
teos,
Attaching that file was unnecessary as SP stores its custom block codes in a db table. Let us try to include the main jQuery library.
/* Unread Posts Block v1.4 || c/o Underdog @ http://askususaquestion.net */
global $settings, $sourcedir;
@require_once($sourcedir . '/PortalUnread.php');
/* Current default settings are for a full display example */
/* Recommended settings for compact display (ie. side block) : */
/* $parameters['container_style'] = 'font-family:Helvetica;font-size:10px; */
/* $parameters['display'] = 'compact'; */
/* --------------------------------------------BLOCK SETTINGS-------------------------------------------- */
$seconds = 60;
$auto_refresh = true; /* Change to false to disable auto refresh */
/* Basic settings */
$parameters['type'] = 'Topics'; /* Posts/Topics */
$parameters['rows'] = '5'; /* (int) Amount of posts/topics per page */
$parameters['display'] = 'full'; /* full/compact */
$parameters['show_icon'] = 'yes'; /* yes/no - Show new icon */
$parameters['full_height'] = 35; /* (int) Uniform row height for full display */
$parameters['compact_height'] = 45; /* (int) Uniform row height for compact display */
$parameters['container_class'] = 'mediumtext'; /* Set the css class for the whole container .. */
$parameters['container_style'] = 'font-family:Helvetica;font-size:12px;'; /* Set the css attributes for the whole container */
// $parameters['boards'] = '1|2|3|4'; /* Specific boards to display ... uncomment to use this option! */
/* This is the number of recent topics to select new one's from */
$parameters['limit'] = 30; /* (int) Maximum amount of posts/topics to display */
/* Image/Language Text ... set $parameters['unread_icons'] = false; to disable images & use text */
/* All images located in directory /Themes/default/images/sp */
$parameters['unread_icons'] = true;
$parameters['prev'] = 'Önceki sayfa';
$parameters['next'] = 'Sonraki sayfa';
$parameters['vbar_x'] = '|';
$parameters['vbar_y'] = '|';
/* Starting page */
$_SESSION['sp_current_page'] = 1;
/* --------------------------------------------END BLOCK SETTINGS-------------------------------------------- */
/* Execute & then let jQuery reset the container every xx milliseconds */
sportal_unread($parameters, false, false);
if ($auto_refresh)
echo '<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.9.0"></script>
<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.3.2.min.js"></script>
<script type="text/javascript">
setInterval(function() {
$("#sp_content").load(location.href+" #sp_content","");
event.stopPropagation();
}, '.((int)$seconds * 1000).');
</script>';
-
teos,
If that does not work, perhaps the stop.propagation command is causing the issue so you can try removing it..
/* Unread Posts Block v1.4 || c/o Underdog @ http://askususaquestion.net */
global $settings, $sourcedir;
@require_once($sourcedir . '/PortalUnread.php');
/* Current default settings are for a full display example */
/* Recommended settings for compact display (ie. side block) : */
/* $parameters['container_style'] = 'font-family:Helvetica;font-size:10px; */
/* $parameters['display'] = 'compact'; */
/* --------------------------------------------BLOCK SETTINGS-------------------------------------------- */
$seconds = 60;
$auto_refresh = true; /* Change to false to disable auto refresh */
/* Basic settings */
$parameters['type'] = 'Topics'; /* Posts/Topics */
$parameters['rows'] = '5'; /* (int) Amount of posts/topics per page */
$parameters['display'] = 'full'; /* full/compact */
$parameters['show_icon'] = 'yes'; /* yes/no - Show new icon */
$parameters['full_height'] = 35; /* (int) Uniform row height for full display */
$parameters['compact_height'] = 45; /* (int) Uniform row height for compact display */
$parameters['container_class'] = 'mediumtext'; /* Set the css class for the whole container .. */
$parameters['container_style'] = 'font-family:Helvetica;font-size:12px;'; /* Set the css attributes for the whole container */
// $parameters['boards'] = '1|2|3|4'; /* Specific boards to display ... uncomment to use this option! */
/* This is the number of recent topics to select new one's from */
$parameters['limit'] = 30; /* (int) Maximum amount of posts/topics to display */
/* Image/Language Text ... set $parameters['unread_icons'] = false; to disable images & use text */
/* All images located in directory /Themes/default/images/sp */
$parameters['unread_icons'] = true;
$parameters['prev'] = 'Önceki sayfa';
$parameters['next'] = 'Sonraki sayfa';
$parameters['vbar_x'] = '|';
$parameters['vbar_y'] = '|';
/* Starting page */
$_SESSION['sp_current_page'] = 1;
/* --------------------------------------------END BLOCK SETTINGS-------------------------------------------- */
/* Execute & then let jQuery reset the container every xx milliseconds */
sportal_unread($parameters, false, false);
if ($auto_refresh)
echo '<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.9.0"></script>
<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.3.2.min.js"></script>
<script type="text/javascript">
setInterval(function() {
$("#sp_content").load(location.href+" #sp_content","");
}, '.((int)$seconds * 1000).');
</script>';
-
Unfortunately the result is negative. with stop.propogation or without.
Test evnvr.
Chrome use posts ...
Neither opera nor firefox refreshes for the new topic/post
if I manualy refresh then the new topics/posts come through...
I have the mod " scrolling buttons" which uses jquery and functions properly, so I assume jquery is on.
Maybe some others as well since it was just a dirty check on jquery.
Maybe some other mod overrides this function ... I'm not sure ...
-
teos,
Test it with other blocks containing jQuery disabled to see if something is conflicting. Perhaps have the block show on another page of your forum that contains no other blocks for testing purposes.
-
The only test I can do is, to create a new page with the code in it and no other blocks.
with stop.propagaiton and without -> negative.
I cannot do the other test ( disabling jquery ) from my end since I have so many mods installed.
Most of the time they give errors depending on each other.
Fancybox is also another mod using jquery and works ...
So I'm hopeless, I deadly need this code in fact ...
-
Maybe helps,
During the execution, I opened java console ...
GET http://123 . com/Themes/default/scripts/sp-jquery-1.9.0 404 (Not Found) page,page1707.html:303
Uncaught TypeError: Cannot call method 'create' of undefined measureIt.js:120
************* startProtect 2datetime: Fri Feb 01 2013 23:16:51 GMT+0200 (xxx Standard Time) Ex.js:1109
3
Uncaught TypeError: Cannot call method 'stopPropagation' of undefined
I dont have sp-jquery-1.9.0 in the themes/default/scripts , how can can I get it?
Hımm... Seems I only used the code but not installed the new portaladvunread.zip
I'll install it with the package manager but what about the previous one (v1.3) , I dont see the previous one on the package manager installed list. Should I go on without uninstalling the previous one ?
-
teos,
The package in the first post includes the file & places it in the proper directory.
Uninstall the package & make sure to delete it from your list of packages. Afterward, download the attachment in the first post & use your package manager to install it anew. Ensure you are selecting the proper package from your computer when uploading to the package manager.
-
The question is uninstalling V1.3 now. Since it is not shown in the installed packages list, I dont know what do remove manually.
Silly me, sorry it is SP-unread . I'll uninstall, and feedback accordingly.
Sorry again, keeping you busy.
-
Test results ...
1-) execution from the block at the main page still gives 404 error for sp-jquery-1.9.0.js
checked the file, js file is there with premissions 666
2-) execution from seperate page gives ...
Uncaught TypeError: Cannot call method 'create' of undefined measureIt.js:120
(anonymous function) measureIt.js:120
************* startProtect 2datetime: Fri Feb 01 2013 23:50:49 GMT+0200 (xxx Standard Time) Ex.js:1109
-
Yesterday, when I was closing chrome, I got a msg on the screen, similiar to " too much jquery ....." .
envr. Windows 8 Google Chrome and opera and firefox, for test purposes.
Today, I tested again, and functions properly. Seems there is a limit somewhere for jquery.
Thanks alot for your efforts, It's one of the best blocks I've ever used.
-
teos,
Imo use the block code from the first post of this thread (if it works for you) as loading that other js file is not necessary within the block code (it is used in the php file). What you are referring to might be resolved by adding the event.stopPropagation command in your other blocks/mods that use jquery (at the end of their function).
ref. Stop jQuery events from bubbling up the DOM tree (http://api.jquery.com/event.stopPropagation/)
For support regarding those other mods/blocks, you will have to ask their authors, post questions at simplemachines.org support or perhaps on a forum that is specifically for jQuery support.
-
Hello all.
I am totally newbish in forum and web designing. Just uploaded my SMF forum with SimplePortal integrated in my host server and works well.
So, i want to add a block in SimplePortal that shows unread messages. I installed the package and followed the instructions from this topic http://simpleportal.net/index.php?topic=11774.0 , but when i trying to add a custom block with the php code provided on the topic i get an error message:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@mystie.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
What can i do to overcome this problem? Thanks
-
Do you have enabled safe_mode?
-
NervoServo,
I merged your topic with the actual block with which you are having an issue as this thread is for its specific support.
Please ensure you are indeed attempting to create a PHP block and also make sure the necessary file attached to the first post has been put in the appropriate directory prior to adding the block.
-
Ok Underdog thanks for the merge. (thanks also for this useful mod, i hope it gonna work for me also :) ).
So, i try to add php block for sure, but the same error code continuously.
As for the file, i just uploaded via package manager the file in the first post and then installed it.
@phantomm: What is safe mode? I have no enabled any safe mode, i think. Where can i ensure that?
The problem still there anyway.
-
NervoServo,
The package + block should be working fine as I just tested it. Are you using some sort of free host by any chance? Does any other mod work after you install it via the package manager?
Using FTP, check to make sure there is the PortalUnread.php file in /Sources .. attempt changing its permission setting to 0755 (do not forget the 0).
There are also 3 javascript files that this mod puts into /Themes/default/scripts :
- sp-jquery-1.3.2.min.js
- sp-jquery-1.9.0.js
- sp-pager.js
Ensure all those files are in that directory and attempt changing their permission setting to 0755
If those files are not in those directories you may have to copy them manually via FTP else some sort of permission issue could cause the error you are seeing due to not being able to access those files.
-
Thnaks for the reply.
So these files were on the right directories, but permissions were set on 0666. I set them on 0755 now, but the problem and the message error still the same. Kinda strange hehe.
*The host is not providing free services, i pay for it.
*I installed a pack of modifications via package manager (about 3-4 total) after simpleportal mod installation.
edit: I just uninstalled SimplePortal and installed it again, and the same problem exists.
-
Underdog,
At The Star Trek RPG Site, I had to uninstall this due to a conflict with that StarDate I have. It seems they conflict somehow. WHen installed, the page somehow refreshes, instead of the block, and get white page with nothing except the StarDate...LOL
I have never seen such a thing! Now I know the StarDate code can be a pain, but never imagined that happening.
However, that is ok. I don't need this there. I have it running nicely on 3 other sites. Thank you, my friend for such a great addition to SP. :)
-
@phantomm: What is safe mode? I have no enabled any safe mode, i think. Where can i ensure that?
You can check it by creating PHP file (name it whatever you want) with this content:
<?php
phpinfo();
?>
Save file and send it to your FTP, now run it in any web browser and look for safe_mode:
(http://img694.imageshack.us/img694/8274/phpinfoq.png)
-
BurkeKnight,
Perhaps there is a like reference id on the page?
You can try this PHP block that should have a uniform id:
/* Unread Posts Block v1.4 || c/o Underdog @ http://askususaquestion.net */
global $settings, $sourcedir;
@require_once($sourcedir . '/PortalUnread.php');
/* Current default settings are for a full display example */
/* Recommended settings for compact display (ie. side block) : */
/* $parameters['container_style'] = 'font-family:Helvetica;font-size:10px; */
/* $parameters['display'] = 'compact'; */
/* --------------------------------------------BLOCK SETTINGS-------------------------------------------- */
$seconds = 60;
$auto_refresh = true; /* Change to false to disable auto refresh */
/* Basic settings */
$parameters['type'] = 'Posts'; /* Posts/Topics */
$parameters['rows'] = '5'; /* (int) Amount of posts/topics per page */
$parameters['display'] = 'full'; /* full/compact */
$parameters['show_icon'] = 'yes'; /* yes/no - Show new icon */
$parameters['full_height'] = 35; /* (int) Uniform row height for full display */
$parameters['compact_height'] = 45; /* (int) Uniform row height for compact display */
$parameters['container_class'] = 'mediumtext'; /* Set the css class for the whole container .. */
$parameters['container_style'] = 'font-family:Helvetica;font-size:12px;'; /* Set the css attributes for the whole container */
// $parameters['boards'] = '1|2|3|4'; /* Specific boards to display ... uncomment to use this option! */
/* This is the number of recent topics to select new one's from */
$parameters['limit'] = 30; /* (int) Maximum amount of posts/topics to display */
/* Image/Language Text ... set $parameters['unread_icons'] = false; to disable images & use text */
/* All images located in directory /Themes/default/images/sp */
$parameters['unread_icons'] = true;
$parameters['prev'] = 'Prev';
$parameters['next'] = 'Next';
$parameters['vbar_x'] = '|';
$parameters['vbar_y'] = '|';
/* Starting page */
$_SESSION['sp_current_page'] = 1;
/* --------------------------------------------END BLOCK SETTINGS-------------------------------------------- */
/* Execute & then let jQuery reset the container every xx milliseconds */
echo '<div id="UnreadPosts2">', sportal_unread($parameters, false, false), '</div>';
if ($auto_refresh)
echo '<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.3.2.min.js"></script>
<script type="text/javascript">
setInterval(function() {
$("#UnreadPosts2").load(location.href+" #UnreadPosts2","");
event.stopPropagation();
}, '.((int)$seconds * 1000).');
</script>';
NervoServo,
The permission value of 0666 would have also been fine. Atm I am not sure what your issue is and will have to brainstorm more ideas for you. Are you able to view your server php error log? Not the SMF error log rather the server error log. If you have errors in either for the time of attempting to use the block please post them here.
-
Guys thanks for your replies
@phantom: It says that safe mode is off
@Underdog: The only error logfile i found on my cpanel contains tons of this type of errors:
[Mon Jun 24 18:06:15 2013] [error] [client Ip number] File does not exist: /home/mysite/public_html/500.shtml, referer: http://www.mysite.com/index.php?action=admin;area=portalblocks;sa=add
[Mon Jun 24 18:02:34 2013] [error] [client Ip number] File does not exist: /home/mysite/public_html/500.shtml, referer: http://www.mysite.com/index.php?action=admin;area=portalblocks;sa=add
[Mon Jun 24 18:00:30 2013] [error] [client Ip number] File does not exist: /home/mysite/public_html/404.shtml, referer: http://www.mysite.com/index.php?action=forum
[Mon Jun 24 18:00:30 2013] [error] [client IP Number] File does not exist: /home/mysite/public_html/Themes/Inno_2/css/webkit.css, referer: http://www.mysite.com/index.php?action=forum
[Mon Jun 24 18:00:14 2013] [error] [client IP number] File does not exist: /home/mysite/public_html/404.shtml, referer: http://www.mysite.com/index.php?action=forum
This is the error you are looking for or something else?
I tried to upload webkit.css from /themes/default/css/" to themes/inno_2/css/ but nothing changed, the problem still the same.
-
Still getting the blank scree with just the star date.
Seems to take a few moments to happen.
Here is a file that has the error log from server, mod list, and the code for the star date.
Also, no errors in smf, strangely. You'll see why I say that when look at the server's log.
-
NervoServo
[Mon Jun 24 18:06:15 2013] [error] [client Ip number] File does not exist: /home/mysite/public_html/500.shtml, referer: http://www.mysite.com/index.php?action=admin;area=portalblocks;sa=add
[Mon Jun 24 18:02:34 2013] [error] [client Ip number] File does not exist: /home/mysite/public_html/500.shtml, referer: http://www.mysite.com/index.php?action=admin;area=portalblocks;sa=add
Those 2 errors happened when you attempted to save the block in which case it was just looking for the html (shtml) file that displays a custom error page. I would have to see other error logs to clarify what is going on with it but you may not have access to those being a shared hosting client. I doubt your actual smf error log will say anything but check anyway & post it if possible.
BurkeKnight,
It seems as though there is some conflict with the 2 blocks. You say that when that stardate block is disabled this mod works fine? Can you post the actual code of the stardate block? What you posted has a hard coded number in it so I assume it was a copy of the page source? I need to see the actual code.
-
StarDate is not a block. It is hard coded into the index.template.php file.
<center><b><font size="3"><font color="#FFFF00">Stardate:</font><font color="#00FFFF"> <SCRIPT language=javascript>
<!-- // -- made by Heath Coop of TrekConnection.com, please keep these credits when using this script
var Now = new Date()
var NowTime = Now.getTime()/1000
var Day = Now.getDate()
var Month = Now.getMonth()+1
var Year = Now.getYear();
if (Year < 2000) Year = Year + 1900
if (Year<1000) { YearDif=Math.abs(Year-87) }
if (Year>1000) { YearDif=Math.abs(Year-1987) }
SDYear=40000+(YearDif*1000)
YearStart = new Date(Year,0,1,0,0,0)
var YearStartTime= YearStart.getTime()/1000
Days=(NowTime-YearStartTime)/86400
if (Days>=183) { SDYear=SDYear+1000
SDDays=(Days*(1000/365))-500 }
if (Days<183) { SDDays=500+(Days*(1000/365)) }
StarDate=Math.floor((SDYear+SDDays) * 10 + .5) / 10
document.write(StarDate) // -->
</SCRIPT>
</font></font></b></center>
-
BurkeKnight,
I am assuming that you narrowed the issue down to that code by removing it which allowed the Adv Unread Posts to function. If this is correct, try replacing that code you just posted with this:
<span style="font-size: 3em;font-weight: bold;display: block; text-align: center;overflow: hidden;margin: 0 auto;position: relative;padding: 10px;">
<span style="color:#FFFF00;">
Stardate:
</span>
<span id="myStardate" style="color:#00FFFF;">
</span>
</span>
<script type="text/javascript"><!-- // --><![CDATA[
// -- made by Heath Coop of TrekConnection.com, please keep these credits when using this script
var Now = new Date();
var NowTime = Now.getTime()/1000;
var Day = Now.getDate();
var Month = Now.getMonth()+1;
var Year = Now.getYear();
if (Year < 2000) {
Year = Year + 1900;
}
if (Year<1000) {
YearDif = Math.abs(Year-87);
}
if (Year>1000) {
YearDif = Math.abs(Year-1987);
}
SDYear = 40000+(YearDif*1000);
YearStart = new Date(Year,0,1,0,0,0);
var YearStartTime = YearStart.getTime()/1000;
Days=(NowTime-YearStartTime)/86400;
if (Days>=183) {
SDYear = SDYear+1000;
SDDays = (Days*(1000/365))-500;
}
if (Days<183) {
SDDays = 500+(Days*(1000/365));
}
StarDate = Math.floor((SDYear+SDDays) * 10 + .5) / 10;
document.getElementById("myStardate").innerHTML = StarDate;
// ]]></script>
-
Still doing it.
No, I did not remove the StarDate before.
I was only thinking it could be that because of the coding.
Funny thing is, it only goes to the blank page if on main page. I leave it sitting in admin section, and does not happen.
However, I do have other issues on the site, like the drop down menus refusing to drop down.
These issues all have to be caused by something, and I have no idea what.
Another mod I have that maybe could cause some issues, is the tooltip mod.
-
BurkeKnight,
On a local test site I have the stardate code, the adv. unread posts block and the tooltip block I wrote not long ago. All function on the same page (home page) without issue.
btw: I just fixed the css on that stardate code in my last post.. if you would prefer to use it since the markup for the css I used is current compared to some of the deprecated original coding you provided.
-
The new one now works.
I made a mistake last night.
Accidentally edited the wrong one.
Don't forget what I said on the site about the new site after the update.
I still have the old site up and running, and had edited THAT one last night by mistake! LOL
Thanks and sorry for that.
P.S. If could log in there and see the menu issue, and try to come up with ideas, would appreciate it.
-
Hi,
I hope it's okay to post in this topic even though it hasn't been posted in for 90 days. :)
I'm wondering about this block/function. When I use it on my site all members are automatically updated in the onlinelist giving the false impression that they have reloaded the whole site. Which confuses people when it comes to private messages. They think that other people are ignoring them and so on.
So I wonder if it would be possible to refresh just the block but not update whatever logs the last_active (?) function. Hope that makes sense.
It's truly a great block/mod otherwise and I assume for most people this is not a big deal. It does give the impression that the site is really active. :)
-
Hope it would be okay if I "bumped" this topic since it was 30 days ago :) Thought perhaps it could have been missed.
-
This is an AWESOME block, thanks so much for creating this! two questions:
1. Is this easy on the serverload if there is none viewing the main page?
2. Can a jquery transition be added so that each new post slides down and moves the others with a stylish animation? http://www.kanyetothe.com does a great job of this and I'd love if this could do the same.
-
samborabora,
The use of resources should be minimal. When I have some time will look at the example link you posted & possibly implement something for you however currently my scarce free time involves another project.
Also check out this thread: http://simpleportal.net/index.php?topic=13574.20 .. which involves something similar but uses the standard format for display.
Regards.
-
samborabora,
The use of resources should be minimal. When I have some time will look at the example link you posted & possibly implement something for you however currently my scarce free time involves another project.
Also check out this thread: http://simpleportal.net/index.php?topic=13574.20 .. which involves something similar but uses the standard format for display.
Regards.
That would be brilliant if you could! Here's an example of code that I've seen that should be similar to what I am looking for:
else if(stuff[1]=='latest'){
if(!window.hoverlatest){
ii = ii + 1;
$('.forum_right_section .column_box_content').prepend('<div id="newmsg'+ii+'" class="column_box_content_row cb_board_row" style="opacity:0;font-size:12px !important"><span class="cb_content_info"><a href="/forum/index.php?msg='+stuff[2]+'"><img src="images/boardicons/'+stuff[0]+'.jpg" height="24px" width="84px" /></a><div><span class="cb_article_title"><a href="/forum/index.php?msg='+stuff[2]+'">'+stuff[3]+'</a></span></div><div><span class="cb_board_by"><a href="/forum/index.php?msg='+stuff[2]+'">by '+stuff[4]+'</a></span></div><br style="clear: both;" /></div>');
$('#newmsg'+ii).animate({ opacity: 1 }, 350);
}
If that helps in any way, hope so. Just not sure how to implement this idea myself (terrible jscript coder here!!)
-
Once again, really appreciate you considering this, what kind of rewriting would be required? Is it something that could be modded onto the existing script or would it need a whole new backend?
-
Sorry to bump this, but I'd be keen on finding any help I can in getting this visual transition to work and I'm not very good with jquery animations :/ any help would be most appreciated, and I can try and give better examples if required :D
-
I've probably got some settings wrong but is it possible to have this block:
constantly show the same results as if you were to visit: index.php?action=unreadreplies ?
-
Very much likely because I have seen it in use :P
-
I *REALLY* need this, and it's BRILLIANT....except when you try to view unread topics it doesn't load the block or the page....
/* Unread Posts Block v1.4 || c/o Underdog @ http://askususaquestion.net */
global $settings, $sourcedir;
@require_once($sourcedir . '/PortalUnread.php');
/* Current default settings are for a full display example */
/* Recommended settings for compact display (ie. side block) : */
/* $parameters['container_style'] = 'font-family:Helvetica;font-size:10px; */
/* $parameters['display'] = 'compact'; */
/* --------------------------------------------BLOCK SETTINGS-------------------------------------------- */
$seconds = 60;
$auto_refresh = true; /* Change to false to disable auto refresh */
/* Basic settings */
$parameters['type'] = 'topics'; /* Posts/Topics */
$parameters['rows'] = '5'; /* (int) Amount of posts/topics per page */
$parameters['display'] = 'full'; /* full/compact */
$parameters['show_icon'] = 'yes'; /* yes/no - Show new icon */
$parameters['full_height'] = 25; /* (int) Uniform row height for full display */
$parameters['compact_height'] = 45; /* (int) Uniform row height for compact display */
$parameters['container_class'] = 'mediumtext'; /* Set the css class for the whole container .. */
$parameters['container_style'] = 'font-family:open sans;font-size:14px;'; /* Set the css attributes for the whole container */
$parameters['boards'] = '17'; /* Specific boards to display ... uncomment to use this option! */
/* This is the number of recent topics to select new one's from */
$parameters['limit'] = 10; /* (int) Maximum amount of posts/topics to display */
/* Image/Language Text ... set $parameters['unread_icons'] = false; to disable images & use text */
/* All images located in directory /Themes/default/images/sp */
$parameters['unread_icons'] = true;
$parameters['prev'] = 'Prev';
$parameters['next'] = 'Next';
$parameters['vbar_x'] = '|';
$parameters['vbar_y'] = '|';
/* Starting page */
$_SESSION['sp_current_page'] = 1;
/* --------------------------------------------END BLOCK SETTINGS-------------------------------------------- */
/* Execute & then let jQuery reset the container every xx milliseconds */
sportal_unread($parameters, false, false);
if ($auto_refresh)
echo '<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.3.2.min.js"></script>
<script type="text/javascript">
setInterval(function() {
$("#sp_content").load(location.href+" #sp_content","");
event.stopPropagation();
}, '.((int)$seconds * 1000).');
</script>';
-
Also if no posts are found is there a way I can hide the block?
-
I *REALLY* need this, and it's BRILLIANT....except when you try to view unread topics it doesn't load the block or the page....
/* Unread Posts Block v1.4 || c/o Underdog @ http://askususaquestion.net */
global $settings, $sourcedir;
@require_once($sourcedir . '/PortalUnread.php');
/* Current default settings are for a full display example */
/* Recommended settings for compact display (ie. side block) : */
/* $parameters['container_style'] = 'font-family:Helvetica;font-size:10px; */
/* $parameters['display'] = 'compact'; */
/* --------------------------------------------BLOCK SETTINGS-------------------------------------------- */
$seconds = 60;
$auto_refresh = true; /* Change to false to disable auto refresh */
/* Basic settings */
$parameters['type'] = 'topics'; /* Posts/Topics */
$parameters['rows'] = '5'; /* (int) Amount of posts/topics per page */
$parameters['display'] = 'full'; /* full/compact */
$parameters['show_icon'] = 'yes'; /* yes/no - Show new icon */
$parameters['full_height'] = 25; /* (int) Uniform row height for full display */
$parameters['compact_height'] = 45; /* (int) Uniform row height for compact display */
$parameters['container_class'] = 'mediumtext'; /* Set the css class for the whole container .. */
$parameters['container_style'] = 'font-family:open sans;font-size:14px;'; /* Set the css attributes for the whole container */
$parameters['boards'] = '17'; /* Specific boards to display ... uncomment to use this option! */
/* This is the number of recent topics to select new one's from */
$parameters['limit'] = 10; /* (int) Maximum amount of posts/topics to display */
/* Image/Language Text ... set $parameters['unread_icons'] = false; to disable images & use text */
/* All images located in directory /Themes/default/images/sp */
$parameters['unread_icons'] = true;
$parameters['prev'] = 'Prev';
$parameters['next'] = 'Next';
$parameters['vbar_x'] = '|';
$parameters['vbar_y'] = '|';
/* Starting page */
$_SESSION['sp_current_page'] = 1;
/* --------------------------------------------END BLOCK SETTINGS-------------------------------------------- */
/* Execute & then let jQuery reset the container every xx milliseconds */
sportal_unread($parameters, false, false);
if ($auto_refresh)
echo '<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.3.2.min.js"></script>
<script type="text/javascript">
setInterval(function() {
$("#sp_content").load(location.href+" #sp_content","");
event.stopPropagation();
}, '.((int)$seconds * 1000).');
</script>';
Can anyone help with this? It's making a bit of a mess of things and I really need this block to alert staff of new issues.
It also doesn't work on the recent posts, unread replies...etc pages.
-
Did you install the package attached to the first post?
-
Yes :D.
-
I used to use this, too, but stopped, as it seemed to have such a large empty block for most part. Even if posts were listed, the block always seemed too big for the list. As if, the block is a set height, instead of fluid.
-
I did a copy&paste of the code in your post into a block and it apparently works fine, could you give more hints on how you configured it? ;)
And "how" exactly it is failing? I'm not sure if it is on any page or just in particular ones.
-
Here's a video my fiance uploaded for me...
https://www.youtube.com/watch?v=yxh0t6r28-Y
-
heh.
One of the few coding guidelines really meaningful and actually very good of SMF is "do not use the suppress error unless *really* needed".
The problem is:
Fatal error: Cannot redeclare unreadTopics() (previously declared in /.../Sources/Recent.php:423) in /.../Sources/PortalUnread.php on line 355
So the solution if rename the unreadTopics function declared in PortalUnread.php to something else, sp_unreadTopics for example, and of course change all the usages of that function inside the file and the code of the block.
Of course renaming it may reveal other similar errors.
-
I tried that it says there's a syntax error in the block code when i tried to save (even though there were no changes) and now it says this on pages:
Fatal error: Call to undefined function unreadtopics() in /Sources/PortalUnread.php on line 44
function sp_advUnreadTopics is what I renamed it to, in case sp_unreadTopics was in use.
-
You have to change also the places the function is called.
So, line 44 of PortalUnread.php you will have:
unreadtopics();
or something similar, and you have to put:
sp_advUnreadTopics();
or alike depending how it was in origin.
-
No line 44 is this:
$items = $type($limit, null, $boards, 'array');
function sportal_unread($parameters, $id, $return_parameters = false)
{
global $txt, $scripturl, $settings, $context, $color_profile, $boardurl;
$block_parameters = array(
'boards' => 'boards',
'limit' => 'int',
'type' => 'select',
'display' => 'select',
);
if ($return_parameters)
return $block_parameters;
$boards = !empty($parameters['boards']) ? explode('|', $parameters['boards']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$rows = !empty($parameters['rows']) ? (int) $parameters['rows'] : 5;
$type = 'unread' . (!empty($parameters['type']) ? $parameters['type'] : 'Posts');
$display = !empty($parameters['display']) ? $parameters['display'] : 'full';
$prev = !empty($parameters['prev']) ? $parameters['prev'] : 'Prev';
$next = !empty($parameters['next']) ? $parameters['next'] : 'Next';
$vertical_bar_x = !empty($parameters['vbar_x']) ? $parameters['vbar_x'] : '|';
$vertical_bar_y = !empty($parameters['vbar_y']) ? $parameters['vbar_y'] : '|';
$images = !empty($parameters['unread_icons']) ? $parameters['unread_icons'] : false;
$items = $type($limit, null, $boards, 'array');
$row_height_full = !empty($parameters['full_height']) ? (int) $parameters['full_height'] : 35;
$row_height_compact = !empty($parameters['compact_height']) ? (int) $parameters['compact_height'] : 45;
$show_icon = !empty($parameters['show_icon']) ? $parameters['show_icon'] : 'yes';
$current_page = !empty($_SESSION['sp_current_page']) ? (int) $_SESSION['sp_current_page'] : 1;
$class = !empty($parameters['container_class']) ? $parameters['container_class'] : 'mediumtext';
$style = !empty($parameters['container_style']) ? $parameters['container_style'] : 'font-family:Helvetica;';
if ($display == 'full')
$height = ($rows+1.88) * $row_height_full;
else
$height = ($rows+0.88) * $row_height_compact;
$counter = 0;
-
Replace everything with the attached.
-
Thanks so much! That works now! I wouldn't have figured that out on my own, thank you!! :D
-
Instead of unread, its possibile to change for unreply??
-
Possible is certainly possible. It requires to rewrite the query to fetch the "unreply" following the one used by SMF for the same function.
/me hopes Chan Zhen has some moment to look into the matter. :angel:
-
I did everything installed it added the php code, however when i post a new topic or reply nothing ever shows up on the block just says "No posts were found."
-
I did everything installed it added the php code, however when i post a new topic or reply nothing ever shows up on the block just says "No posts were found."
Did you try to set the options inside the code up or did you just blindly copy/paste it? ;)