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,
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
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.
The following should work. Add the following code to the PHP part of the template: PHP: 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 );
This is what my news_count.php file looks like, but I'm not getting an output. HTML: <?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"; } ?>
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. HTML: <!-- 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="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="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>
Below the HTML part. You need to click "Add PHP part to this template" and a new field for the PHP appear.
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.
How would I exclude a second channel in the news counter? I had to create another channel that isn't for reviews.
This should do the trick: PHP: $results = $database -> dbquery( "SELECT newsstory_id FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE NOT(newsstory_channels LIKE '%1a1a1a1a%') OR NOT(newsstory_channels LIKE '%2b2b2b2b%')" );
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!
I have the counter inside my site_login file. This is the code from my site_login_anon.php: HTML: 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 );