Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
Eduardo
Worker
Worker



Joined: Jul 20, 2004
Posts: 189
Location: Italy

PostPosted: Sat Jul 25, 2009 2:36 am Reply with quote

Please help me to add last 10 and the scroll into the following block:

Code:
<?php

if ( !defined('BLOCK_FILE') ) {
   Header('Location: ../index.php');
   die();
}

global $prefix, $db;
$content = "";
$page_content = array();
$result = $db->sql_query("SELECT pid, cid, title FROM " . $prefix . "_pages WHERE active='1'");
while (list($pid, $cid, $title) = $db->sql_fetchrow($result)) {
   $page_content[$cid][] = array('pid'=>$pid, 'title'=>$title);
}

$result2 = $db->sql_query("SELECT cid, title FROM " . $prefix . "_pages_categories");
while (list($cid, $title) = $db->sql_fetchrow($result2)) {
  $content .= "<b>&nbsp;<strong><big>&middot;</big></strong>&nbsp;<a href=\"content-cat-.html$cid\">$title</a></b><br>";
   if(!empty($page_content[$cid])){
      foreach($page_content[$cid] as $value){
         $content .= "&nbsp;&nbsp;&middot;&nbsp;<a href=\"contentid-.html".$value['pid']."\">".$value['title']."</a><br>";
      }
   }
}

?>


Many thanks.
 
View user's profile Send private message
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Wed Sep 09, 2009 2:55 pm Reply with quote

Wow how did this one escape us?

<bump> Sad
 
View user's profile Send private message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Wed Sep 09, 2009 4:25 pm Reply with quote

If you still need help with this please clarify exactly what you are trying to do.

Are you trying to list every category and then show the last 10 pages for each.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
Unit1
Worker
Worker



Joined: Oct 26, 2004
Posts: 134
Location: Boston

PostPosted: Wed Sep 09, 2009 6:32 pm Reply with quote

jakec your getting old Welcome to the dark side Smile

_________________
* 5 Simple rules to be happy: * Free Your Heart from Hatred * Free Your Mind from Worries * Live Simply * Give More * Expect Less. 
View user's profile Send private message
jakec







PostPosted: Thu Sep 10, 2009 12:25 am Reply with quote

Thanks Unit1 Laughing
 
Eduardo







PostPosted: Thu Sep 10, 2009 1:20 am Reply with quote

Yes, so:
· Category 1
    · page 1
    · page 2
    · page 3
    · page 4
    · page 5
    · page 6
    · page 7
    · page 8
    · page 9
    · page 10

· Category 2
    · page 1
    · page 2
    · page 3
    · page 4
    · page 5
    · page 6
    · page 7
    · page 8
    · page 9
    · page 10


All scrolling.

Many thanks for your help.


Last edited by Eduardo on Sun Sep 13, 2009 12:26 am; edited 1 time in total 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Fri Sep 11, 2009 8:02 pm Reply with quote

What order should the categories and then pages appear?

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Eduardo







PostPosted: Sat Sep 12, 2009 12:51 am Reply with quote

montego wrote:
What order should the categories and then pages appear?

Categories: Alphabetical

Pages: Chronological
 
Eduardo







PostPosted: Sat Nov 28, 2009 5:14 am Reply with quote

Please inform me if the modifications I ask is difficult to achieve.
 
montego







PostPosted: Sat Nov 28, 2009 9:10 am Reply with quote

Eduardo, just thought of something, what about pages with no category?

Edited: Also, you say pages should be chronological, but what order? I.e., Most recent first or the opposite?
 
Eduardo







PostPosted: Sat Nov 28, 2009 11:10 am Reply with quote

Most recent first.

In the script I inserted the category is cronological. I need alphabetical.
 
montego







PostPosted: Sun Nov 29, 2009 2:58 pm Reply with quote

Eduardo, ok, worked on this a little bit and here is what I came up with:

Code:


<?php
if (!defined('BLOCK_FILE')) {
   Header('Location: ../index.php');
   die();
}

$blkh = 10;        // Number of lines high
$blkw = 45;        // Number of characters wide 0 = unused
$scron = 1;        // Turn scrolling on by setting to 1
$scrdr = 'up';     // Scroll direction (up, down, left, or right)
$scrhg = 200;      // Scroller height in pixels
$scrwd = 145;      // Scroller width in pixels
$speed = 2;        // Speed Of Scroll
$scrolldelay = 75; // Scroll delay - small the number the smoother the scroll

global $prefix, $db;
$content = '';

$result = $db->sql_query('SELECT `cid`, `title` FROM `' . $prefix . '_pages_categories` ORDER BY `title`');
if ($db->sql_numrows($result) > 0) {
   if ($scron == 1) {
      $content .= '<marquee behavior="scroll" direction="'.$scrdr.'" height="'.$scrhg.'" width="'.$scrwd.'" scrollamount="'.$speed.'" scrolldelay="'.$scrolldelay.'" onmouseover="this.stop()" onmouseout="this.start()"><br />';
   }
   $content .= '<div id="ContentLast"><ul>'; // special 'id' is provided so can style the <ul> tags according to personal liking via ".ContentLast ul" and ".ContentLast ul ul"
   // Cycle through each category
   while (list($cid, $title) = $db->sql_fetchrow($result)) {
      $content .= '<li>' . $title;
      $result1 = $db->sql_query('SELECT `pid`, `title` FROM `' . $prefix . '_pages` WHERE `active` = \'1\' AND `cid` = \'' . $cid . '\' ORDER BY `pid` DESC LIMIT 10');
      if ($db->sql_numrows($result1) > 0) {
         $content .= '<ul>';
         while (list($pid, $ptitle) = $db->sql_fetchrow($result1)) {
            $content .= '<li><a href="contentid-' .$pid . '.html">' . $ptitle .'</a></li>';
         }
         $content .= '</ul>';
      }
      $content .= '</li>';
   }
   $content .= '</ul></div>';
   if ($scron == 1) {
      $content .= '</marquee>';
   }
}

?>


This is what you have asked for thus far plus a little bit more (with the marquee options). I added a special DIV wrapper to it so that you can use CSS to style the individual <ul> tags to your liking.

Hopefully you found this helpful and wouldn't mind donating to Raven's site here a little bit to help out with covering his expenses. Wink
 
Eduardo







PostPosted: Mon Nov 30, 2009 10:33 am Reply with quote

I made a donation.
Congratulations on your skill and sophistication.
I have some problems of style.
The margins are too far.
On the categories there are not the links and the bold in the text, even the text color is not correct.

Please go to [ Only registered users can see links on this board! Get registered or login! ]
and compare the last block (YOURS) with the penultimate (MINE).
The blocks are in the left side, the name is "Notizie da ..."
 
montego







PostPosted: Wed Dec 02, 2009 6:26 am Reply with quote

Eduardo, I could not find any CSS statements in any of your .css files to style this. You need to add the proper CSS to this theme file:

themes/fiapple211/style/style.css

Here are just a couple of things to try to get you started (add to the above file):

Code:


.ContentLast ul {
  margin: 0;
  padding: 0;
  list-style-position: inside;
}

.ContentLast ul ul {
  margin: 0;
  padding: 0;
  list-style-position: inside;
}



That should give you some ideas on how to style it.
 
Eduardo







PostPosted: Wed Dec 02, 2009 8:56 am Reply with quote

Following style.css
At the end there is your code.
Imperfections have not changed.
I am not able to solve the problem.

Code:
FONT { 

font-family : Verdana, Helvetica;
font-size : 10px;
}
TD {
font-family : Verdana, Helvetica;
font-size : 10px;
}
BODY {
font-family : Verdana, Helvetica;
font-size : 10px;
}
P {
font-family : Verdana, Helvetica;
font-size : 10px;
}
DIV {
font-family : Verdana, Helvetica;
font-size : 10px;
}
body {
background : #f1f1f1 url(../forums/images/lines.gif);
color : #000000;
font : 12px Verdana, Arial, Helvetica, sans-serif;
margin : 6px;
padding : 0;
}
font, th, td, p {
font : 10px Verdana, Arial, Helvetica, sans-serif;
}
.gensmall {
font-size : 10px;
}
td.genmed, .genmed {
font-size : 11px;
}
.explaintitle {
font-size : 11px;
font-weight : bold;
color : #5c81b1;
}
a:link, a:active, a:visited, a.postlink {
color : #4682b4;
text-decoration : none;
}
a:hover {
color : #000000;
text-decoration : underline;
}
.topictitle {
font-size : 11px;
font-weight : bold;
}
a.topictitle:visited {
color : #5493b4;
}
a.topictitle:hover {
color : #000000;
}
.name {
font-size : 11px;
font-weight : bold;
}
hr {
border : 0 solid #757575;
border-top-width : 1px;
height : 0;
}
td.cat, td.rowpic {
font-weight : bold;
letter-spacing : 1px;
background : #dedede url(../forums/images/catbkg.gif);
height : 27px;
text-indent : 4px;
}
td.cathead {
font-weight : bold;
letter-spacing : 1px;
background : #f1f1f1 url(../forums/images/lines.gif);
height : 29px;
}
.row1 {
background : #f5f5f5;
}
.row2, .helpline {
background : #ececec;
}
.row3 {
background : #e3e3e3;
}
td.spacerow {
background : #ffffff;
}
th {
background : #f1f1f1 url(../forums/images/lines.gif);
color : #333333;
font-size : 11px;
font-weight : bold;
height : 27px;
white-space : nowrap;
text-align : center;
padding-left : 8px;
padding-right : 8px;
}
.bodyline {
background : #fbfbfb;
border : 1px solid #666666;
}
.forumline {
background : #757575;
border : 0;
}
.maintitle, h1 {
font : bold 20px/120% "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
text-decoration : none;
color : #939393;
}
.subtitle, h2 {
font : bold 18px/180% "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
text-decoration : none;
}
.nav {
font-size : 11px;
font-weight : bold;
}
.postbody {
font-size : 12px;
line-height : 125%;
}
.postdetails {
font-size : 10px;
color : #353535;
}
.quote {
background : #fafafa;
border : 1px solid #d1d7dc;
color : #444444;
font-size : 11px;
line-height : 125%;
}
.code {
background : #fafafa;
border : 1px solid #d1d7dc;
color : #006600;
font : 12px Courier, "Courier New", sans-serif;
padding : 5px;
}
.errorline {
background : #d3e4f3;
border : 1px solid #666666;
}
input {
border-color : #000000;
color : #000000;
background-color : #ffffff;
font : normal 11px Verdana, Arial, Helvetica, sans-serif;
border-width : 1px 1px 1px 1px;
}
textarea {
border-color : #000000;
color : #000000;
background-color : #ffffff;
font : normal 11px Verdana, Arial, Helvetica, sans-serif;
border-width : 1px 1px 1px 1px;
}
select {
border-color : #000000;
color : #000000;
font : normal 11px Verdana, Arial, Helvetica, sans-serif;
}
input.post, textarea.post {
background : #ffffff;
border : 1px solid #000000;
font : 11px Verdana, Arial, Helvetica, sans-serif;
padding-bottom : 2px;
padding-left : 2px;
}
input.button, input.liteoption, .fakebut {
border : 1px solid #000000;
background : #d4d0c8;
font-size : 11px;
}
input.catbutton {
border : 1px solid #000000;
background : #d4d0c8;
font-size : 10px;
}
input.mainoption {
border : 1px solid #000000;
background : #d4d0c8;
font-size : 11px;
font-weight : bold;
}
a.but, a.but:hover, a.but:visited {
color : #000000;
text-decoration : none;
}
.helpline {
border : 0 solid;
font-size : 10px;
}
.admin, .mod {
font-size : 11px;
font-weight : bold;
}
.admin, a.admin, a.admin:visited {
color : #ff0000;
}
.mod, a.mod, a.mod:visited {
color : #006600;
}
a.admin:hover, a.mod:hover {
color : #000000;
}
img {
border : 0;
}
.tt12bkg {
background : url(../forums/images/tt12_m.gif) repeat-x;
height : 12px;
width : 100%;
}
.tb12bkg {
background : url(../forums/images/tb12_m.gif) repeat-x;
height : 12px;
width : 100%;
}
.ttb {
width : 100%;
}
.scrntbkg {
background : url(../forums/images/scrn_t.gif) repeat-x;
height : 14px;
width : 100%;
}
.scrnbbkg {
background : url(../forums/images/scrn_b.gif) repeat-x;
height : 14px;
width : 100%;
}
.scrnlbkg {
background : url(../forums/images/scrn_l.gif) repeat-y;
width : 14px;
}
.scrnrbkg {
background : url(../forums/images/scrn_r.gif) repeat-y;
width : 14px;
}
.scrn {
width : 100%;
text-align : center;
}
td.scrnm {
background : #ffffff;
}
.postbkg {
background : url(images/tabblank.gif) repeat-y;
height : 20px;
}
.title {
background : none;
color : #000000;
font-size : 13px;
font-weight : bold;
font-family : Verdana, Helvetica;
text-decoration : none;
}
.content {
background : none;
color : #000000;
font-size : 10px;
font-family : Verdana, Helvetica;
}
.block-title {
background : none;
color : #000000;
font-size : 11px;
font-family : Verdana, Helvetica;
}
.storytitle {
background : none;
color : #000000;
font-size : 11px;
font-weight : bold;
font-family : Verdana, Helvetica;
text-decoration : none;
}
.storycat {
background : none;
color : #000000;
font-size : 11px;
font-weight : bold;
font-family : Verdana, Helvetica;
text-decoration : underline;
}
.boxtitle {
background : none;
color : #000000;
font-size : 10px;
font-weight : bold;
font-family : Verdana, Helvetica;
text-decoration : none;
}
.boxcontent {
background : none;
color : #000000;
font-size : 10px;
font-family : Verdana, Helvetica;
}
.option {
background : none;
color : #000000;
font-size : 10px;
font-weight : bold;
font-family : Verdana, Helvetica;
text-decoration : none;
}
.tiny {
background : none;
color : #000000;
font-size : 10px;
font-weight : normal;
font-family : Verdana, Helvetica;
text-decoration : none;
}
.small {
background : none;
color : #000000;
font-size : 9px;
font-weight : normal;
font-family : Verdana, Helvetica;
text-decoration : none;
}
.footmsg {
background : none;
color : #000000;
font-size : 9px;
font-weight : normal;
text-align : center;
font-family : Verdana, Helvetica;
text-decoration : none;
}
.ContentLast ul {
  margin: 0;
  padding: 0;
  list-style-position: inside;
}
.ContentLast ul ul {
  margin: 0;
  padding: 0;
  list-style-position: inside;
}
 
montego







PostPosted: Sat Dec 05, 2009 9:51 am Reply with quote

Dang it! My apologies! I used an "id" not "class". Change each of the ".ContentLast" to "#ContentLast". So sorry about that. Sad
 
Eduardo







PostPosted: Mon Dec 07, 2009 12:53 pm Reply with quote

Dear Montego many thanks.

I need the link and the bold style on the category.
 
montego







PostPosted: Wed Dec 09, 2009 6:44 am Reply with quote

Eduardo, I have given you enough, I believe, to where you can now look up the other CSS that you need to do this quite easily. Yes, I could do this for you, but then you wouldn't learn anything from it. The following is an excellent site for learning CSS: [ Only registered users can see links on this board! Get registered or login! ]
 
Eduardo







PostPosted: Wed Dec 09, 2009 8:07 am Reply with quote

I think the solution is in the block code, not in the CSS file.

My first block make the bold text and the link to the category by the following script:

Quote:
$content .= "<b>&nbsp;<strong><big>&middot;</big></strong>&nbsp;<a href=\"content-cat-.html$cid\">$title</a></b><br>";
if(!empty($page_content[$cid])){
foreach($page_content[$cid] as $value){
$content .= "&nbsp;&nbsp;&middot;&nbsp;<a href=\"contentid-.html".$value['pid']."\">".$value['title']."</a><br>";

not by CSS file.

I can learn the CSS discipline, but surely it will not suffice.
I am sorry that you live in Arizona.
You'd certainly an excellent teacher for me.
Unfortunately I live in the most extreme points of Europe.
During this life I can only design systems. To make next life.
 
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Wed Dec 09, 2009 9:06 am Reply with quote

Something like this should give you the main cat link. You could use bold or strong tags to make it bold.

find and replace
Code:
   $content .= '<li>' . $title;

     

with
Code:
   

      $content .= '<li><a href="content-cat-'.$cid.'.html">'.$title.'</a>';

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
Eduardo







PostPosted: Thu Dec 10, 2009 1:39 am Reply with quote

Thanks for your help but for me it is not enough.
Unfortunately I am not able to complete the good work done by Montego.
Please, try you to complete the block.
 
Eduardo







PostPosted: Thu Dec 10, 2009 3:28 am Reply with quote

Montego
I checked the block, also the link of the content pages are break.
 
montego







PostPosted: Thu Dec 10, 2009 6:37 am Reply with quote

Eduardo, the original block code that you provided appeared to me to use ShortLinks or other form of GoogleTap, therefore, that is the style link that I provided and it works perfectly in my environment. In addition, there are NO code changes needed, only CSS, in order to get the category titles bolded and the links underlined.

Tell you what. I do not have time today to do this for you, but I will be off work tomorrow and will make these tweaks for you. HOWEVER, please let me know what type of nuke system you are running, plus version, and whether you are using ShortLinks, or GT-NExtGEn or any other type of link shortening system.
 
Eduardo







PostPosted: Thu Dec 10, 2009 8:58 am Reply with quote

RavenNuke v 2.30.02
Content Plus 2.2.1
Today I am not using ShortLinks/GT-NExtGEn.
 
montego







PostPosted: Fri Dec 11, 2009 10:02 am Reply with quote

Ok, here is the completed block. Take a look at some of the configuration options that you have available:

Code:


<?php
/**
 * Content Plus: Last NN Content Pages Block
 *
 * This script may be used in either RavenNuke(tm) or PHP-Nuke along with
 * either the regular Content module or Content Plus module and is quite
 * configurable, including scrolling (not XHTML compliant).
 *
 * PHP versions 4 and 5
 *
 * LICENSE: GNU/GPL 2
 *
 * @package     RavenNuke(tm)
 * @subpackage  Content Plus
 * @category    Blocks
 * @author      Rob Herder (aka: montego) <montego@montegoscripts.com>
 * @copyright   2009 by RavenPHPScripts and Montego Scripts
 * @license     http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt GNU/GPL 2
 * @version     1.0
 * @link        http://www.ravenphpscripts.com and http://montegoscripts.com
 * @since       2.50.00
 * @uses        The configuration options below should be self-explanatory.
 */
if (!defined('BLOCK_FILE')) {
   Header('Location: ../index.php');
   die();
}
/**
 * Configuration Options
 */
$pages = 10;         // Number of pages (max) per category to show
$blkh = 10;          // Number of lines high
$blkw = 45;          // Number of characters wide 0 = unused
$scron = 0;          // Turn scrolling on by setting to 1
$scrdr = 'up';       // Scroll direction (up, down, left, or right)
$scrhg = 200;        // Scroller height in pixels
$scrwd = 145;        // Scroller width in pixels
$speed = 2;          // Speed of scroll
$scrolldelay = 75;   // Scroll delay - small the number the smoother the scroll
$showcatlink = true; // true = provide category link, false = no category link (default)

global $prefix, $db;
$content = '';
$result = $db->sql_query('SELECT `cid`, `title` FROM `' . $prefix . '_pages_categories` ORDER BY `title`');
if ($db->sql_numrows($result) > 0) {
   if ($scron == 1) {
      $content .= '<marquee behavior="scroll" direction="' . $scrdr . '" height="' . $scrhg . '" width="' . $scrwd . '" scrollamount="' . $speed . '" scrolldelay="' . $scrolldelay . '" onmouseover="this.stop()" onmouseout="this.start()"><br />';
   }
   $content .= '<div id="ContentLast"><ul>'; // special 'id' is provided so can style the <ul> tags according to personal liking via "#ContentLast ul" and "#ContentLast ul ul"
   // Cycle through each category
   while (list($cid, $title) = $db->sql_fetchrow($result)) {
      $content .= '<li>';
      if ($showcatlink) {
         $content .= '<a href="modules.php?name=Content&amp;pa=list_pages_categories&amp;cid=' . $cid . '">' . $title . '</a>';
      } else {
         $content .= $title;
      }
      $result1 = $db->sql_query('SELECT `pid`, `title` FROM `' . $prefix . '_pages` WHERE `active` = 1 AND `cid` = ' . (int)$cid . ' ORDER BY `pid` DESC LIMIT ' . $pages);
      if ($db->sql_numrows($result1) > 0) {
         $content .= '<ul>';
         // Cycle through each page within the given category
         while (list($pid, $ptitle) = $db->sql_fetchrow($result1)) {
            $content .= '<li><a href="modules.php?name=Content&amp;pa=showpage&amp;pid=' . $pid . '">' . $ptitle . '</a></li>';
         }
         $content .= '</ul>';
      }
      $content .= '</li>';
   }
   $content .= '</ul></div>';
   if ($scron == 1) {
      $content .= '</marquee>';
   }
}
?>


For your CSS, you can try the following:

Code:


#ContentLast ul {
   margin: 0;
   padding: 0;
   list-style-position: inside;
   font-weight: bold;
}

#ContentLast ul ul {
   padding-left: 1em;
   list-style-position: inside;
   font-weight: normal;
}


Style should NEVER be applied using the old HTML tags any longer.

ShortLinks/GT "taps" are not provided because you are not using them.

This should do it?

P.S. I am going to recommend this block for our 2.5.0 release and/or for Jonathan if he wishes to include with ContentPlus.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©