News Bulletin - RSS feed generator, News Bulletin, News Manager... - Page 2 News Bulletin - RSS feed generator, News Bulletin, News Manager... - Page 2
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

News Bulletin - RSS feed generator, News Bulletin, News Manager...

Started by just_some_guy, November 11, 2007, 06:08:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

just_some_guy

Maybe it something to do with your server, put this in a new file and then open the page. Then check to see if the table is created. Once the table is created you will be able to use the plugin.


$sql = 'CREATE TABLE `cpg1411_plugin_news` ('
        . ' `id` INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
        . ' `active` VARCHAR(10) NOT NULL, '
        . ' `rss` VARCHAR(10) NOT NULL, '
        . ' `date` DATE NOT NULL, '
        . ' `value` LONGTEXT NOT NULL, '
        . ' `name` VARCHAR(500) NOT NULL, '
        . ' `title` VARCHAR(500) NOT NULL'
        . ' )'
        . ' ENGINE = myisam'
        . ' COMMENT = \'Stores data for the News Bulletin plugin by just_some_guy.\';';

$result = cpg_db_query($sql);
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

will

I entered what you gave me to create the table and I got an error:

#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '$sql = 'CREATE TABLE `cpg1411_plugin_news` ('
        . ' `id`

just_some_guy

Hmm, run this using a tool like phpmyadmin.

CREATE TABLE `cpg1411_plugin_news` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`active` VARCHAR( 10 ) NOT NULL ,
`rss` VARCHAR( 10 ) NOT NULL ,
`date` DATE NOT NULL ,
`value` LONGTEXT NOT NULL ,
`name` VARCHAR( 500 ) NOT NULL ,
`title` VARCHAR( 500 ) NOT NULL
) ENGINE = MYISAM COMMENT = '''Stores data for the News Bulletin plugin by just_some_guy.';
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

will

Thats what I'm using and I entered what you gave me this time and I get:

MySQL said:

#1074 - Too big column length for column 'name' (max = 255). Use BLOB instead ???

just_some_guy

Ahh, must be a variation between the set up of your mysql and mine. Simple fix. run this code -


CREATE TABLE `cpg1411_plugin_news` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`active` VARCHAR( 10 ) NOT NULL ,
`rss` VARCHAR( 10 ) NOT NULL ,
`date` DATE NOT NULL ,
`value` LONGTEXT NOT NULL ,
`name` VARCHAR( 255 ) NOT NULL ,
`title` VARCHAR( 255 ) NOT NULL
) ENGINE = MYISAM COMMENT = '''Stores data for the News Bulletin plugin by just_some_guy.';
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

will

Right the table has been created, I went back to installing the plugin (the 2nd attachment) it gives me the same error:

mySQL error: Too big column length for column 'name' (max = 255). Use BLOB instead ???

just_some_guy

Thats because its running that code again (the one that does not work for you). I have attached a modded version which skips the step of creating a table as you have done it manually. Then you can use the plugin, let me know if it works.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

will

Fantastic it worked. Thanks for the mod and thanks for all your help in making it work ;D

just_some_guy

Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

will

EDIT: If you saw the last post I was wrong, when I place it before the categories it pushes the categories next to it when you click "news", everything is ok when you don't click "news" and if you place it at the bottom of the gallery, so basically if there is something after it, it messes up the gallery when clicked ;)

http://cdcoverhideout.com/gallery

just_some_guy

Weird, i never noticed that as i have my news block at the bottom of the page. I will look into that and get back to you. Sorry,
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

just_some_guy

Fixed, minor bug there, thanks for pointing that out.

To fix it.

Open /plugins/News_Bulletin/news.php

find

  <table align="left" width="100%" cellspacing="1" cellpadding="0" class="maintable" id="section"  border="0">

and replace with

<table id="section"  class="maintable" border="0">
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

will

Thank you sorted, top man, 1 more thing please and this will be the last time lol.

Is there a way of making the news show by default and then members can click to make it disappear ;)

just_some_guy

Yes, delete this from news.php -


<script type="text/javascript">
        onload = hideall;
</script>


No problem,
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

will

Thank you, that makes it show but what about making it disappear if you choose to ;)

just_some_guy

Sure,

Replace the contents of news.php with this -


<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2007 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.4.13
  $Source$
  $Revision: 3837 $
  $Author: gaugau $
  $Date: 2007-08-16 18:56:06 +0200 (Do, 16 Aug 2007) $
**********************************************/
<<<EOT

<script type="text/javascript">
function expand2()
{
        var Nodes = document.getElementsByTagName("table")
        var max = Nodes.length
        for(var i = 0;i < max;i++) {
                var nodeObj = Nodes.item(i)
                var str = nodeObj.id
                if (str.match("section")) {
                        nodeObj.style.display = 'block';
                }
        }
}

</script>
<style>
text-align: left;
</style>

EOT;

if (!
defined('IN_COPPERMINE')) die('Not in Coppermine...');
echo <<< EOT


                <tr>
                        <td class="tableh2"  onclick="show_section('section')" >
                                <span style="cursor:pointer" ><img src="images/descending.gif" border="0" width="9" height="9" alt="" title="
{$lang_admin_php['click_expand']}" /> <b>News</b></span><a/>
                        </td>
                </tr>
                <tr>
                        <td>

                                <table id="section"  class="maintable" border="0">
EOT;

$sql ="SELECT * FROM cpg1411_plugin_news  WHERE active=1 ORDER BY date DESC";
$result cpg_db_query($sql);
while (
$row mysql_fetch_assoc($result)) {
echo 
'<tr>';
echo 
'<td align="left">';
echo 
"<strong><span style=\"text-decoration: underline\">";
echo  
$row["title"] , "<br />";
echo 
"</strong></span>";
echo 
'</td>';
echo 
'<td>';
echo  
$row["date"] , "<br />";
echo 
'</td>';
echo 
'<tr>';
echo 
'<td align="left">';
echo  
$row["value"] ,"<br />";
echo 
'</td>';
echo 
'</td>';
echo 
'<br/>';
echo  
'</tr>';



}
echo 
'</table>';






?>




just_some_guy,

EDIT - make sure you use this code ^^^^ will. I edited my post with a correction.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

will

not working, also found a issue in IE, when you hover over the main section all the text is highlighted, looks fine in FF ???

Joachim Müller

Will, what I was trying to say: you lack the experience to be the first user to install this plugin and use it. If it doesn't work for you out of the box, then it is not meant for you. I haven't looked into this plugin, but if you can't answer the basic question (what happens when the plugin tries to create the table in the first place? Does the mysql user have create permissions?), then you just don't qualify for this plugin. Look at this thread and how cluttered it already is, even though the plugin is very young.

just_some_guy

Will, check my site - http://www.mysimtractor.com and scroll to the bottom of the page. The news block is exactly how you wanted, isn't it? - its expanded when the page loads and when clicking the text "News" it collapses and vise -versa. That was using the code i posted a few posts ago. I use IE and cannot replicate this error.

Sorry, GauGau for the mess this is making to the board, i assure the plugin does work as you can see on my site.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

just_some_guy

New version released; this address a minor bug fix found by will. I have also released a version which loads with the news block open and in this version i have changed some of the values used when creating the table so that it can be used on mysql servers that have maximum char count lower than 500.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums