71
playsome
xcgal hack make searches return album title instead of picture info
  • 2011/6/11 17:59

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hello all,

I have a small hack that might be usefull to someone hopefully. This hack to xcgal include/search.php will, when a users uses xoops search or for example mysearch to search your site, return the an album title and link to that albums thumbnail rather than return the picture info.

The reason for this hack is that on a site i manage, i have a custom lightbox and intermediate pictures turned off when searching i noticed that picture thumbnails where showing but where not clickable in anyway so I thought that returning the album title and link to the album thumbnails page would be much better.

So heres the code i have commented out unneeded code rather than deleting it, i have tested it on xoops core search and mysearch module and it seems to work fine, any feedback would be appreciated.

<?php
// $Id: search.php,v 1.1 2005/08/30 06:27:31 mcleines Exp $
//modified by playsome on 11 June 2011
//Search now returns album name instead of picture information
//usefull if you use a lightbox and have intermediate pictures turned off

function xcgal_search($queryarray$andor$limit$offset$userid){
    global 
$xoopsDB;
    
//$xcgalCon = search_album_set();
    
$sql "SELECT aid, title FROM ".$xoopsDB->prefix("xcgal_albums");
    
/*if ( $userid != 0 ) {
        $sql .= " AND owner_id=".$userid." $ALBUM_SET_SEARCH";
    }*/
    // because count() returns 1 even if a supplied variable
    // is not an array, we must check if $querryarray is really an array
    
if ( is_array($queryarray) && $count count($queryarray) ) {
        
$sql .= " WHERE ((title LIKE '%$queryarray[0]%')";
        for(
$i=1;$i<$count;$i++){
            
$sql .= $andor ";
            
$sql .= "(title LIKE '%$queryarray[$i]%')";
        }
        
$sql .= ") ";
    }
//end if
    
$sql .= "ORDER BY title DESC";
    
$result $xoopsDB->query($sql,$limit,$offset);
    
$ret = array();
    
$i 0;
     while(
$myrow $xoopsDB->fetchArray($result)){
         
/*if ($xcgalCon['search_thumb'] == 1 ) $ret[$i]['image'] = $xcgalCon['fullpath'].str_replace("%2F","/",rawurlencode($myrow['filepath'].$xcgalCon['thumb_pfx'].$myrow['filename']));*/
         
$ret[$i]['image'] = "images/xcgal.gif";
        
$ret[$i]['link'] = "thumbnails.php?album=".$myrow['aid']."";//link to the album id
        
$ret[$i]['title'] = $myrow['title'];
        
$i++;
    }
    return 
$ret;
}

/*function search_album_set()
{
    global $ALBUM_SET_SEARCH, $xoopsDB, $xoopsUser;
    if (is_object ($xoopsUser)){
        $usergroups= $xoopsUser->getgroups();
        $usergroup= implode(",",$usergroups);
        $buid= $xoopsUser->uid();
    } else {
        $usergroup= XOOPS_GROUP_ANONYMOUS;
        $buid = 0;
    }
    $user_cat = 10000;
    $module_handler= & xoops_gethandler('module');
    $xcgalModule = $module_handler->getByDirname('xcgal');
    $config_handler =& xoops_gethandler('config');
    $xcgalCon =& $config_handler->getConfigsByCat(0, $xcgalModule->mid());
    if(is_object($xoopsUser) && $xoopsUser->isAdmin($xcgalModule->mid())) $ALBUM_SET_SEARCH= "";
    else {
    $result = $xoopsDB->query("SELECT aid FROM ".$xoopsDB->prefix("xcgal_albums")." WHERE visibility NOT IN ($usergroup, 0,".($user_cat + $buid).")");
    if (($xoopsDB->getRowsNum($result))) {
        $set ='';
        while($album=$xoopsDB->fetchArray($result)){
            $set .= $album['aid'].',';
        } // while
        $ALBUM_SET_SEARCH .= 'AND aid NOT IN ('.substr($set, 0, -1).') ';
    }
    $xoopsDB->freeRecordSet($result);
    }
    return $xcgalCon;
}*/
?>



72
playsome
Re: replace FCKeditor with xoopsformdhtmltextarea in tad faq?
  • 2011/5/24 0:27

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


HI, can someone post a tutorial on how to add dhtml text areas, even say to a custom module so I can see how its done, sadly im not getting very far.

This is what ive got so far

include (XOOPS_ROOT_PATH."/class/xoopsform/formdhtmltextarea.php");
    
$snForm = new XoopsFormDhtmlTextArea('content',5,50);
    
$snForm->render();


then to display the form

td class='col'>$snForm</td></tr>


needless to say the form does not load.

it was my understanding that calling the render method of the class would, well render the form, thats where im stuck i dont know what else is required to get the form to display. am I calling the method correctly? with ->


Another option to get syntax highlighting:

I downloaded syntax highlighter form alexgorbatchev.com included all the files as required in index_tpl

<!--syntax highlighter core-->
<
script type="text/javascript" src="<{xoAppUrl /modules/tad_faq/sh/shCore.js}>"></script>
<!--include 
brushes-->
<
script type="text/javascript" src="<{xoAppUrl /modules/tad_faq/sh/brushes/shBrushJava.js}>"></script>
<
script type="text/javascript" src="<{xoAppUrl /modules/tad_faq/sh/brushes/shBrushJScript.js}>"></script>
<
script type="text/javascript" src="<{xoAppUrl /modules/tad_faq/sh/brushes/shBrushPhp.js}>"></script>
<
script type="text/javascript" src="<{xoAppUrl /modules/tad_faq/sh/brushes/shBrushCss.js}>"></script>
<
script type="text/javascript" src="<{xoAppUrl /modules/tad_faq/sh/brushes/shBrushAS3.js}>"></script>
<!--
stylesheets-->
<
link href="<{xoAppUrl /modules/tad_faq/sh/shCore.css}>" type="text/css" rel="stylesheet" />
<
link href="<{xoAppUrl /modules/tad_faq/sh/shThemeDefault.css}>" type="text/css" rel="stylesheet" />
<
script type="text/javascript">
    
SyntaxHighlighter.all()
</
script>
<{
$toolbar}>
<{
$css}>
<{
$content}>


tried adding some javascript into fck editor using script method as explained on syntaxhihglighter site but the syntax highlighter does not show up the code just shows as text, when putting the javascript into fckeditor 'view source' nothing shows up at all.

anyone got any ideas?

thanks




73
playsome
replace FCKeditor with xoopsformdhtmltextarea in tad faq?
  • 2011/5/22 19:27

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hello all,

I am trying to figure out how i would replace fckeditor which is the default editor of the module tad faq, the reason is I am trying to alter tad faq into a module for displaying code snippets for a site im working on and I want to be able to use xcode so i can have the syntax highlighting.

I have a rough understanding ob oo programming (java) but I cant figure out how to instantiate a new dhtmltextarea object, in the orginal code of tad_faq/admin/add.php it looks like only one parameter (content) was being passed when instantiating the new fck editor object but am i correct in saying that there should be at least 2 parameters for xoopsformdhtmltextarea ?

here is the code of tad_faq/admin/add.php:

<?php
//  ------------------------------------------------------------------------ //
// ¥»¼Ò²Õ¥Ñ tad »s§@
// »s§@¤é´Á¡G2008-07-02
// $Id: function.php,v 1.1 2008/05/14 01:22:08 tad Exp $
// ------------------------------------------------------------------------- //

/*-----------¤Þ¤JÀÉ®×°Ï--------------*/
include "../../../include/cp_header.php";
include 
"../function.php";
include_once 
XOOPS_ROOT_PATH."/Frameworks/art/functions.php";
include_once 
XOOPS_ROOT_PATH."/Frameworks/art/functions.admin.php";

/*-----------function°Ï--------------*/

//¤ÀÃþ¿ï³æ
function get_faq_cate_opt($the_fcsn=""){
    global 
$xoopsDB;
    
$opt="";
    
$sql "select fcsn,title from ".$xoopsDB->prefix("tad_faq_cate")." order by sort";
    
$result $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3mysql_error());
    while(list(
$fcsn,$title)=$xoopsDB->fetchRow($result)){
      
$selected=($the_fcsn==$fcsn)?"selected":"";
      
$opt.="<option value='$fcsn$selected>$title</option>";
    }
    return 
$opt;
}


//tad_faq_content½s¿èªí³æ
function tad_faq_content_form($fqsn=""){
    global 
$xoopsDB;

    
//§ì¨ú¹w³]­È
    
if(!empty($fqsn)){
        
$DBV=get_tad_faq_content($fqsn);
    }else{
        
$DBV=array();
    }

    
//¹w³]­È³]©w

    
$fqsn=(!isset($DBV['fqsn']))?"":$DBV['fqsn'];
    
$fcsn=(!isset($DBV['fcsn']))?"":$DBV['fcsn'];
    
$title=(!isset($DBV['title']))?"":$DBV['title'];
    
$sort=(!isset($DBV['sort']))?"":$DBV['sort'];
    
$uid=(!isset($DBV['uid']))?"":$DBV['uid'];
    
$post_date=(!isset($DBV['post_date']))?"":$DBV['post_date'];
    
$content=(!isset($DBV['content']))?"":$DBV['content'];
    
$enable=(!isset($DBV['enable']))?"1":$DBV['enable'];
    
    
$faq_cate_opt=get_faq_cate_opt($fcsn);

    include(
XOOPS_ROOT_PATH."/modules/tad_faq/class/fckeditor/fckeditor.php") ;
    
$oFCKeditor = new FCKeditor('content') ;
    
$oFCKeditor->BasePath    XOOPS_URL."/modules/tad_faq/class/fckeditor/" ;
    
$oFCKeditor->Config['AutoDetectLanguage']=false;
    
$oFCKeditor->Config['DefaultLanguage']        = 'en' ;
    
$oFCKeditor->ToolbarSet ='my';
    
$oFCKeditor->Width '515' ;
    
$oFCKeditor->Height '250' ;
    
$oFCKeditor->Value =$content;
    
$editor=$oFCKeditor->CreateHtml() ;


    
$op=(empty($fqsn))?"insert_tad_faq_content":"update_tad_faq_content";
    
//$op="replace_tad_faq_content";
    
$main="
  <form action='
{$_SERVER['PHP_SELF']}' method='post' id='myForm' enctype='multipart/form-data'>
  <table class='form_tbl'>

    <input type='hidden' name='fqsn' value='
{$fqsn}'>
    <tr><td class='title'>"
._MA_TADFAQ_CATE_MENU."</td>
    <td class='col'><select name='fcsn' size=1>
    
$faq_cate_opt
    </select></td></tr>
    <tr><td class='title'>"
._MA_TADFAQ_FAQ_TITLE."</td>
    <td class='col'><input type='text' name='title' size='40' value='
{$title}' style='width:100%;'></td></tr>
    <tr><td class='title'>"
._MA_TADFAQ_CONTENT."</td>
    <td class='col'>
$editor</td></tr>
    <tr><td class='title'>"
._MA_TADFAQ_ENABLE."</td>
    <td class='col'>
    <input type='radio' name='enable' value='1' "
.chk($enable,'1').">"._MA_TADFAQ_FAQ_ENABLE."
    <input type='radio' name='enable' value='0' "
.chk($enable,'0').">"._MA_TADFAQ_FAQ_UNABLE."
    </td></tr>
  <tr><td class='bar' colspan='2'>
  <input type='hidden' name='op' value='
{$op}'>
  <input type='submit' value='"
._MA_SAVE."'></td></tr>
  </table>
  </form>"
;

    
$main=div_3d(_MA_TADFAQ_ADD_CONTENT,$main);

    return 
$main;
}

//·s¼W¸ê®Æ¨ìtad_faq_content¤¤
function insert_tad_faq_content(){
    global 
$xoopsDB,$xoopsUser;
    
    
$uid=($xoopsUser)?$xoopsUser->getVar('uid'):"";
    
$sort=get_max_faq_sort($_POST['fcsn']);
    
    
$sql "insert into ".$xoopsDB->prefix("tad_faq_content")." (`fcsn`,`title`,`sort`,`uid`,`post_date`,`content`,`enable`) values('{$_POST['fcsn']}','{$_POST['title']}','{$sort}','{$uid}',now(),'{$_POST['content']}','{$_POST['enable']}')";
    
$xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3mysql_error());
    
//¨ú±o³Ì«á·s¼W¸ê®Æªº¬y¤ô½s¸¹
    
$fqsn=$xoopsDB->getInsertId();
    return 
$fqsn;
}


//¥H¬y¤ô¸¹¨ú±o¬Yµ§tad_faq_content¸ê®Æ
function get_tad_faq_content($fqsn=""){
    global 
$xoopsDB;
    if(empty(
$fqsn))return;
    
$sql "select * from ".$xoopsDB->prefix("tad_faq_content")." where fqsn='$fqsn'";
    
$result $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3mysql_error());
    
$data=$xoopsDB->fetchArray($result);
    return 
$data;
}

//§ó·stad_faq_content¬Y¤@µ§¸ê®Æ
function update_tad_faq_content($fqsn=""){
    global 
$xoopsDB;
    
    
$sql "update ".$xoopsDB->prefix("tad_faq_content")." set  `fcsn` = '{$_POST['fcsn']}', `title` = '{$_POST['title']}', `post_date` = now(), `content` = '{$_POST['content']}', `enable` = '{$_POST['enable']}' where fqsn='$fqsn'";
    
$xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'],3mysql_error());
    return 
$fqsn;
}

//¦Û°Ê¨ú±o·s±Æ§Ç
function get_max_faq_sort($fcsn=""){
    global 
$xoopsDB,$xoopsModule;
    
$sql "select max(sort) from ".$xoopsDB->prefix("tad_faq_content")." where fcsn='{$fcsn}'";
    
$result $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3mysql_error());
    list(
$sort)=$xoopsDB->fetchRow($result);
    return ++
$sort;
}


/*-----------°õ¦æ°Ê§@§PÂ_°Ï----------*/
$op = (!isset($_REQUEST['op']))? "main":$_REQUEST['op'];

switch(
$op){

    
//·s¼W¸ê®Æ
    
case "insert_tad_faq_content":
    
insert_tad_faq_content();
    
header("location: index.php");
    break;

    
//¿é¤Jªí®æ
    
case "tad_faq_content_form";
    
$main=tad_faq_content_form($_GET['fqsn']);
    break;

    
//§ó·s¸ê®Æ
    
case "update_tad_faq_content";
    
update_tad_faq_content($_POST['fqsn']);
    
header("location: index.php");
    break;
    
    
//¹w³]°Ê§@
    
default:
    
$main=tad_faq_content_form($_GET['fqsn']);
    break;
}

/*-----------¨q¥Xµ²ªG°Ï--------------*/
xoops_cp_header();
echo 
"<link rel='stylesheet' type='text/css' media='screen' href='../module.css' />";
loadModuleAdminMenu(1);
echo 
$main;
xoops_cp_footer();

?>


I have tried instantiating a new XoopsFormDhtmlTextArea object and passing the parameter 'content' but it seems to be not enough parameters and i am now well and trully stumped.

Any help would be appreciated.

Cheers.



74
playsome
Question regarding pagetitles and google and other search engines
  • 2011/4/18 22:00

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hello xoopsers,

I am currently working on a redesign of a xoops based site and I thought I would also try and get all my page titles looking the same, currently, for example on the article module the page titles are like:

Article - article title - site name

I have changed the page titles to

article title | Article | Site Name

the site I am working on is allready well indexed in google, does anyone know if changing page titles like this could have any adverse or negative effects on the pages rankings?

Thanks



75
playsome
Re: Module name on Main Menu
  • 2011/4/7 15:32

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hello,

To change the names of modules go to your admin panel then modules administration then underneath the module logo there is a text box which you can change the default name of the module to anything you like, this will reflect in the module page title as well.

On the module admin page you can also change the weigt of which modules appear in the main menu by changing the values in the order column.

Im not sure what you are meaning in your second question "pre configured menu items", you can change the look of the main menu in your themes style.css file, if a theme has some hard coded menu then it will be inside either theme.html or another file within your theme directory.

Hope this helps you out



76
playsome
Re: place div on homepage only
  • 2011/3/24 18:22

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hi, thanks for your replies, I will them a try.

Thank you.



77
playsome
place div on homepage only
  • 2011/3/24 1:16

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hello, quick question about smarty. In my theme I want to code in a div but have it display on the top page only, the div will be above the footer and stretch the full width of the theme so i dont think i can do it with a block, i need some smarty code that could accompish this

example

<{if body_id == "system"}>
<
div class="mydiv">
...
</
div>
<{/if}>


is there some smarty code that could be used to accomplish this?

Thanks



78
playsome
Re: Links page not working
  • 2011/2/4 22:59

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hi, it sems it is not a completely black white page (which sometimes can happen in xoops if a script is not working or is stopped early) but no links are displaying when a category is clicked.

First thing to do is go into your admin panel and activate php debug, go to your links page, click a category and copy any errors that you see and post them on here.

Also have you updated any templates or anything like that? if you have try clearing the templates cache, clear browser cache and try the links again.



79
playsome
Re: colums are expanding
  • 2011/2/4 22:54

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


The logo centering should work using text-align:center, I tried it using firebug and it seemed OK. Try wrapping the code for the logo inside a dive with the align set to center

<div align="center"><img height="50" align="center" alt="" src="http://i.nixle.com/uploads/support/images/badge2.gif" /></div>


As for the columns issue look at your themes css file and see if the right column is set to a specific width such as width:150px;

If it is set to a width smaller that your element (like the homeland security thing) then the column will expand to fit the width of the element.

See if your columns is a set width, you can edit the width of the advisory image to be smaller.

<img width="177" height="20" border="0" src="http://www.nationalterroralert.com/advisory7.gif">


change the value of width="177" to the same widht as the right column and change the height="20" value to keep the same aspect ration, the only thing is the image might not look great if the size is reduced.

If you are wanting to have both columns the same width you would have to modify the theme to make right and left columns wider and set them to be the same width in the css, but if you insert wider images, etc it will always make the columns wider.



80
playsome
Re: colums are expanding
  • 2011/2/4 20:51

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hi,

you're right column could be expanding because the element you added to the right block is wider that the width of the column, the column will expand to fit the content.

To centre the nixle logo add text-align:center; to the <td> element which contains the logo.

<td style="padding: 5px; text-align:center"><img height="50" align="center" alt="" src="http://i.nixle.com/uploads/support/images/badge2.gif"></td>




TopTop
« 1 ... 5 6 7 (8) 9 10 11 ... 17 »



Login

Who's Online

196 user(s) are online (170 user(s) are browsing Support Forums)


Members: 0


Guests: 196


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits