vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=262)
-   -   PHP Module (https://vborg.vbsupport.ru/showthread.php?t=320927)

DemOnstar 11-29-2015 06:07 AM

PHP Module
 
Okay, I have tried the PHP modules in site builder, dropped in some PHP that I have used before in 4 but it didn't work with 5 so now the page is totally in accessible. I can still gain access to the admin CP. Is there anyway from there to delete the module in site builder from the back end?
Or is there a way to get access to site builder again from what used to be home but now is a blank page?

Basically getting back the page before I added the PHP Module.

Thanks.

Replicant 11-29-2015 01:11 PM

Did you use php open and closing tags? If you did, you should remove those and try again. This is the main cause of problems using the php module. Also make sure the php runs on a regular html page before trying the code in a module.
Go to Admincp >> Options >> General settings and disable "Disable PHP, Static HTML, and Ad Module rendering". Then you can edit the page with site builder.

Here is a tutorial on using PHP modules in VB5
http://www.vbulletin.com/forum/blogs...mysql-database

DemOnstar 11-29-2015 03:31 PM

Quote:

Originally Posted by Replicant (Post 2559483)
Did you use php open and closing tags? If you did, you should remove those and try again. This is the main cause of problems using the php module. Also make sure the php runs on a regular html page before trying the code in a module.

I wouldn't know where to start old boy.

Code:

$flashWidth  = 240;
$flashHeight = 240;
$flashPath = 'tagcloud.swf';
$flashBackgroundColor = 'ffffff';
$tagCount = 30;
$tagMaxSize = 16;
$tagMinSize = 8;

// Colors are in hex
$data['tcolor'] = '0x000000';
$data['tcolor2'] = '0x336699';
$data['hicolor'] = '0x000000';
$data['speed'] = 100;
$data['distr'] = 'true';
$data['mode'] = 'tags';

$contentTypes = array(2=>'tags.php?tag=',15=>'blog.php?tag=');

/* No Editing Below This Line*/

global $vbulletin;

// %d

$query = sprintf("SELECT Tag.tagid, Tag.tagtext, TagContent.contenttypeid, COUNT( TagContent.tagid ) AS count FROM ".TABLE_PREFIX."tag AS Tag LEFT JOIN ".TABLE_PREFIX."tagcontent AS TagContent ON ( Tag.tagid = TagContent.tagid ) GROUP BY TagContent.tagid ORDER BY count DESC LIMIT %d",$tagCount);

$qtags = vB::$db->query_read($query);

while($tag = vB::$db->fetch_array($qtags)) {
    $tags[] = $tag;
    $tagSize[$tag['tagtext']] = $tag['count'];
}

// largest and smallest array values
$maxQty = max(array_values($tagSize));
$minQty = min(array_values($tagSize));

$spread = $maxQty - $minQty;
if ($spread == 0) {
        $spread = 1;
}

$step = ($tagMaxSize - $tagMinSize) / ($spread);

// make the tag cloud
$tagsHTML  = "";
foreach ($tags as $tag)
{
    $size = round($tagMinSize + (($tag['count'] - $minQty) * $step));
    $text = $tag['tagtext'];

    $url = $vbulletin->options['homeurl'].'/'.$contentTypes[$tag['contenttypeid']].urlencode($tag['tagtext']);
    $tagsHTML .= "<a href='$url' style='$size'>$text</a>";
}

$data['tagcloud'] = '<tags>'.$tagsHTML.'</tags>';

$flashVars = "";

foreach($data as $var=>$val)
{
    $flashVars .= (empty ($flashVars))?'':'&';
    $flashVars .= "$var=".urlencode($val);
}

ob_start();
?>
<embed width="<?php echo $flashWidth;?>" height="<?php echo $flashHeight;?>" flashvars="<?php echo $flashVars;?>" wmode="transparent" allowscriptaccess="always" quality="high" bgcolor="#<?php echo $flashBackgroundColor;?>" name="vbCloudFlash" id="vbCloudFlash" style="" src="<?php echo $vbulletin->options['homeurl'].'/'.$flashPath;?>" type="application/x-shockwave-flash"/>
<?php

$content = ob_get_contents();
ob_end_clean();

$output = $content;

I used the above code to try it. It works well with 4.
It talks to an .swf file in the root and is used as a dynamic tag cloud.

Anyway. It screwed up the whole page.

Quote:

Originally Posted by Replicant (Post 2559483)
Go to Admincp >> Options >> General settings and disable "Disable PHP, Static HTML, and Ad Module rendering". Then you can edit the page with site builder.

This did the trick. . . .

Thanks again. . . .

Dragonsys 11-29-2015 03:56 PM

instead of using this:
PHP Code:

?>
<embed width="<?php echo $flashWidth;?>" height="<?php echo $flashHeight;?>" flashvars="<?php echo $flashVars;?>" wmode="transparent" allowscriptaccess="always" quality="high" bgcolor="#<?php echo $flashBackgroundColor;?>" name="vbCloudFlash" id="vbCloudFlash" style="" src="<?php echo $vbulletin->options['homeurl'].'/'.$flashPath;?>" type="application/x-shockwave-flash"/>
<?php

I would make it a var, so you don't have to close/open php, such as this:
PHP Code:

$content '<embed width="".$flashWidth."" height="".$flashHeight."" flashvars="".$flashVars."" wmode="transparent" allowscriptaccess="always" quality="high" bgcolor="#".$flashBackgroundColor."" name="vbCloudFlash" id="vbCloudFlash" style="" src="".$vbulletin->options['homeurl'].'/'.$flashPath."" type="application/x-shockwave-flash"/>'



All times are GMT. The time now is 11:02 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.01095 seconds
  • Memory Usage 1,735KB
  • 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
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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