1 (edited by 2012-12-13 22:29:03)

Topic: Problems with getting scripts to work with the latest version of the CuteNews

http://img195.imageshack.us/img195/4025/beforeaftere.jpg
Well, I was thinking to hear if there was anyone here who could help me with something.

I have updated to CuteNews 1.5.0 and before that, I had a script that I had found here that shows what my categories was (see picture above). But then, in that I updated to the latest edition or version of the CuteNews so didn't  the script not work anymore.

So I was thinking if there is anyone who knows what i will changes so i get the script to work again with CuteNews 1.5.0.

The actual scripet is as follows:

<?PHP
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Configurations
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

// If it is set to FALSE, the categories wont be displayed
// after a visitor click some category to see the news from it
  $display_categories_when_showing_news = TRUE;
 $display_news_under_list = FALSE;

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Main Part (Do not edit below)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$cutepath =  __FILE__;
$cutepath = preg_replace( "'list_cats.php'", "", $cutepath);
$cutepath = preg_replace( "'/list_cats.php'", "", $cutepath);

require_once("$cutepath/inc/functions.inc.php");

if(($show_cat != "" and $display_categories_when_showing_news == TRUE) or $show_cat == ""){
    $cat_lines = file("$cutepath/data/category.db.php") or die("Can not open $cutepath/data/category.db.php");
    foreach($cat_lines as $cat_line){
        $cat_arr = explode("|", $cat_line);
        echo "[url=?show_cat={$cat_arr[0]}]{$cat_arr[1]}[/url]
";
    }
}
if(isset($_GET['show_cat']) && preg_match('/^[1-9]{1}[0-9]{0,}$/', $_GET['show_cat'] && $display_news_under_list)){
    $category = $show_cat;
    include("$cutepath/show_news.php");
}
?>

Would really appreciate if there was anyone who could help me with this.
Thanks so much in advance.

/ Jörgen Lindström, Sweden.


Update:
The little that I know, so it must be something with the code "'list_cats.php" to do.
And it is there that I do not get it. For that I have seen, there is not "'list_cats.php" with the new updated CuteNews.

So my question is then, what should I replace "'list_cats.php" in order to get scripet work?

Re: Problems with getting scripts to work with the latest version of the CuteNews

Try this:

<?PHP
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Configurations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

// If it is set to FALSE, the categories wont be displayed
// after a visitor click some category to see the news from it
  $display_categories_when_showing_news = TRUE;
$display_news_under_list = FALSE;

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Main Part (Do not edit below)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$cutepath =  __FILE__;
$cutepath = preg_replace( "'list_cats.php'", "", $cutepath);
$cutepath = preg_replace( "'/list_cats.php'", "", $cutepath);

//require_once("$cutepath/core/core.php");

if(($show_cat != "" and $display_categories_when_showing_news == TRUE) or $show_cat == ""){
    $cat_lines = file("$cutepath/cdata/category.db.php") or die("Can not open $cutepath/data/category.db.php");
    foreach($cat_lines as $cat_line){
        $cat_arr = explode("|", $cat_line);
        echo "[url=]{$cat_arr[1]}[/url]
";
    }
}
if(isset($_GET['show_cat']) && preg_match('/^[1-9]{1}[0-9]{0,}$/', $_GET['show_cat'] && $display_news_under_list)){
    $category = $show_cat;
    include("$cutepath/show_news.php");
}
?>

Re: Problems with getting scripts to work with the latest version of the CuteNews

Try this:

<?PHP
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Configurations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

// If it is set to FALSE, the categories wont be displayed
// after a visitor click some category to see the news from it
  $display_categories_when_showing_news = TRUE;
$display_news_under_list = FALSE;

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Main Part (Do not edit below)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$cutepath =  __FILE__;
$cutepath = preg_replace( "'list_cats.php'", "", $cutepath);
$cutepath = preg_replace( "'/list_cats.php'", "", $cutepath);

//require_once("$cutepath/core/core.php");

if(($show_cat != "" and $display_categories_when_showing_news == TRUE) or $show_cat == ""){
    $cat_lines = file("$cutepath/cdata/category.db.php") or die("Can not open $cutepath/data/category.db.php");
    foreach($cat_lines as $cat_line){
        $cat_arr = explode("|", $cat_line);
        echo "[url=]{$cat_arr[1]}[/url]
";
    }
}
if(isset($_GET['show_cat']) && preg_match('/^[1-9]{1}[0-9]{0,}$/', $_GET['show_cat'] && $display_news_under_list)){
    $category = $show_cat;
    include("$cutepath/show_news.php");
}
?>

Thank you so much. Works just fine. Now I'm happy.