This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Article/Review Counter for Main page?


avatar
ReviewStud 135
From: -
Article/Review Counter for Main page?

I'll post this in the "Feedback and Suggestions" thread, but is there a way to create a counter on the main page that taunts of how many "news articles/reviews" you have you have posted except for one channel?

Thanks,

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
Changing it to "AND" fixed it.

Thank you very much.
1 Re: Article/Review Counter for Main page?
avatar
Editor
0
From: -
I see the problem. Changing OR to AND should fix the issue.
1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
I have the counter inside my site_login file.

This is the code from my site_login_anon.php:


global $database;

$results = $database -> dbquery( "SELECT newsstory_id FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE NOT(newsstory_channels LIKE '%e6781e67%') OR NOT(newsstory_channels LIKE '%46c78256%')" );

$insert['news_count'] = $database -> dbrows( $results );

1 Re: Article/Review Counter for Main page?
avatar
Editor
0
From: -
How does your current code look like?
1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
It worked perfectly until a few days ago, but now the counter is counting 'all' news articles.
1 Re: Article/Review Counter for Main page?
avatar
Editor
0
From: -
Very odd. It worked before?
1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
Not sure why, but my article counter is back to counting "every" article, not all but two selected news channels. I haven't changed any of the PHP code in my site_login_anon or news_count files or anything in my MySQL database.

Any ideas where I should start? I've gone over the code previously mentioned in this thread and haven't noticed any errors.

HELP!
1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
Excellent!! That did the trick. I was leaving out the "OR" in the code.

Thanks again,
1 Re: Article/Review Counter for Main page?
avatar
Editor
0
From: -
This should do the trick:
$results = $database -> dbquery( "SELECT newsstory_id FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE NOT(newsstory_channels LIKE '%1a1a1a1a%') OR NOT(newsstory_channels LIKE '%2b2b2b2b%')" );
1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
How would I exclude a second channel in the news counter? I had to create another channel that isn't for reviews.
1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
That's did it. I was working on the file in Dreamweaver and was wonder were you were talking about. I was a bit confused.

Thanks for the extra help.
1 Re: Article/Review Counter for Main page?
avatar
Editor
0
From: -
Below the HTML part. You need to click "Add PHP part to this template" and a new field for the PHP appear.
1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
Sorry, but where in the "site_login_anon" is the PHP? This is what I got, but I ain't getting anything from it. PHP isn't my thing.


<!-- Template: site_login_anon -->
<h4>Welcome to ReviewMagnet.com</h4>
<h5>The home of {$insert['global $database;$results = $database -> dbquery( "SELECT newsstory_id FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE NOT(newsstory_channels LIKE '%e6781e67%')" ); $insert['news_count'] = $database -> dbrows( $results );']} reviews and counting.</h5>
<h5>To take full advantage of all features you need to
<strong><a href="https://www.contentteller.com/contentteller{$insert['param_ext']}{$insert['param_ct']}users{$insert['param_action']}login{$insert['param_page']}index.html" rel="nofollow">login</a></strong> or <strong><a href="https://www.contentteller.com/contentteller{$insert['param_ext']}{$insert['param_ct']}users{$insert['param_action']}registration{$insert['param_page']}index.html" rel="nofollow">register</a></strong>. Registration is completely free and takes only a few seconds.</h5>
1 Re: Article/Review Counter for Main page?
avatar
Editor
0
From: -
No, the PHP part of site_login_anon
1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
This is what my news_count.php file looks like, but I'm not getting an output.


<?php

if( !defined( "CONTENTTELLER" ) )
{
die( "Error" );
}

if( $preferences[ 'news_active' ] )
{
$news_count = ( isset( $datastore[ 'news_count' ] ) ) ? $datastore[ 'news_count' ] : "" ;

if( !$news_count )
{
$results = $database -> dbquery( "SELECT newsstory_id FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE NOT(newsstory_channels LIKE '%e6781e67%')" );
echo "The home of " . $database -> dbrows( $results ) . " reviews.";

$system -> datastoreput( "news_count", $news_count );

global $database;

$results = $database -> dbquery( "SELECT newsstory_id FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE NOT(newsstory_channels LIKE '%e6781e67%')" ); $insert['news_count'] = $database -> dbrows( $results );
}

echo $news_count;
}
else
{
echo "The news module is inactive";
}
?>
1 Re: Article/Review Counter for Main page?
avatar
Editor
0
From: -
The following should work. Add the following code to the PHP part of the template:

global $database;

$results = $database -> dbquery( "SELECT newsstory_id FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE NOT(newsstory_channels LIKE '%1a1a1a1a%')" );
$insert['news_count'] = $database -> dbrows( $results );
1 Re: Article/Review Counter for Main page?
avatar
OP 135
From: -
That's works as a block, but I tried to do use it as a "{$insert['news_count']}" script, but I didn't get anything.

I was thinking something more like this:

<!-- Template: site_login_anon -->
<h4>Welcome to URL.com</h4>
<h5>The home of {$insert['news_count']} reviews.</h5>

I am trying to limit how many L&R blocks I have on my site.
1 Re: Article/Review Counter for Main page?
avatar
Editor
0
From: -
Here a block (attachment) that shows how many stories are in the database.

1) Unzip the file and open news_count.php in an editor
2) Replace 1a1a1a1a with the channel ID of the channel that should be excluded
3) Upload news_count.php to the /blocks directory
4) Select "Add New Block" in cadmin and choose "News count" as PHP Block Script
   news_count.zip

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.