vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin CMS Widgets - [WIDGET] PhotoPost Classifieds Latest Items Posted w/images only (https://vborg.vbsupport.ru/showthread.php?t=269668)

Hostboard 09-03-2011 10:00 PM

[WIDGET] PhotoPost Classifieds Latest Items Posted w/images only
 
1 Attachment(s)
I take no credit for the code presented. The code was posted by individuals on PhotoPost.com All I did was put the posted code from the few threads together to make this work and present it in a single location. Also I hope by placing it at .org others who do not visit photopost.com often will be able to use it.

If this code infringes on anything or Chuck at PhotoPost wants it removed please feel free to do so.

If there is a better way to do this, please feel free to post any changes, additions or alterations.

This code is unsupported by me.
Working on 4.1.5pl1
  • Goto Admincp->vBullietin CMS->Widgets->Create New Widget
  • Choose PHP Direct Execution as Widget's Type
  • Place a Title. eg Upcoming Events. Keep it short as this is what will appear as title on your pages.
  • Click Save
  • Click Configure on the right of the new created widget.
  • Remove the default code that appears.
  • Copy and Paste the code that you can find below.
  • Edit: $host, $dbUser, $dbPass, and $db entries to their correct values.
  • Edit: Enter your domain and path to classifieds.
  • Edit: Set limit to number of classifieds you want (currently set for 6)
  • Leave the template name as is (vbcms_widget_execphp_page)
  • Click Save
  • Goto Admincp->vBullietin CMS->Layout Manager
  • Click Go on the Default Layout
  • Add the Widget to your Layout
  • Click Save
Code:

$host = 'localhost';
$dbUser = 'DataBaseUserID';
$dbPass = 'DatebasePassword';
$db = 'DataBaseName';
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

ob_start();

$result = mysql_query("SELECT id,cat,bigimage,title FROM cp_products WHERE bigimage != '' order by rand() LIMIT 6" ) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
print"<center>";
print "<a href=\"http://www.YourDomain.com/PathTo/classifieds/showproduct.php?product=" . $row['id'] . "&cat=" . $row['cat'] . "\"><img src=\"http://www.YourDomain.com/PathTo/classifieds/data/" . $row['cat'] . "/thumbs/" . $row['bigimage'] . "\" border=\"0\"></a>";
print "<br />" . $row['title'] . "</center><br />";
}

$output .= ob_get_contents();
ob_end_clean();

Working Demo: http://www.pwrhouse.com/rcmt/index.php
This is a temporary location for this site. When it becomes 404'd the permanent location will be http://www.rcmt.net and a working demo will be able to be seen there.

1320Nation 09-04-2011 09:33 PM

Guest do not have permission to access this page to view demo. Go ahead and delete this post once you fix the permissions.

Hostboard 09-04-2011 10:19 PM

Quote:

Originally Posted by psychobike (Post 2241978)
Guest do not have permission to access this page to view demo. Go ahead and delete this post once you fix the permissions.

Fixed. Sorry about that...


All times are GMT. The time now is 10:07 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01052 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete