Support jOOmla! Autoit!
文章内增加网摘按钮 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-04-23 | View Count View: 38262 | Digg Count Digg: 159

 增加网摘按钮:

修改文件: /components/com_content/content.php :

搜索:

$params = new mosParameters( $row->attribs );

在他之上加入下面代码保存

   $row->fulltext.="<br /><br /><div align='right'>Shares:
    <a href=\"javascript:location.href='http://www.google.com/bookmarks/mark?op=add&amp;bkmk='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)\"><img alt=\"Google书签\" src=\"/images/share/google.gif\" border=\"0\" /></a>
    <a href=\"javascript:location.href='http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+encodeURIComponent(location.href)+'&amp;t='+encodeURIComponent(document.title)\"><img alt=\"Yahoo书签\" src=\"/images/share/yahoo.gif\" border=\"0\" /></a>
    <a href=\"javascript:location.href='http://myweb.cn.yahoo.com/popadd.html?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)\"><img alt=\"雅虎收藏夹\" src=\"/images/share/yahoomyweb-cn.png\" border=\"0\" /></a>
    <a href=\"javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&amp;u='+escape(d.location.href)+'&amp;c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();\"><img alt=\"365Key网摘\" src=\"/images/share/365key.gif\" border=\"0\" /></a>
    <a href=\"javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(vivi=window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=28&amp;title='+escape(d.title)+'&amp;url='+escape(d.location.href)+'&amp;desc='+escape(t),'vivi','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes'));vivi.focus();\"><img alt=\"新浪ViVi\" src=\"/images/share/vivi.gif\" border=\"0\" /></a>
    <a title=\"百度收藏\" href=\"javascript:u=location.href;t=document.title;c = %22%22 + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text);var url=%22http://cang.baidu.com/do/add?it=%22+encodeURIComponent(t)+%22&amp;iu=%22+encodeURIComponent(u)+%22&amp;dc=%22+encodeURIComponent(c)+%22&amp;fr=ien#nw=1%22;window.open(url,%22_blank%22,%22scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes%22); void 0\"><img alt=\"百度收藏\" src=\"/images/share/baidu.gif\" border=\"0\" /></a>
    <a href=\"javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(yesky=window.open('http://hot.yesky.com/dp.aspx?t='+escape(d.title)+'&amp;u='+escape(d.location.href)+'&amp;c='+escape(t)+'&amp;st=2','yesky','scrollbars=no,width=400,height=480,left=75,top=20,status=no,resizable=yes'));yesky.focus();\"><img alt=\"天极网摘\" src=\"/images/share/yesky.gif\" border=\"0\" /></a>
    <a href=\"javascript:location.href='http://www.diglog.com/submit?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)\"><img alt=\"diglog\" src=\"/images/share/diglog.png\" border=\"0\" /></a>
    <a href=\"javascript:t=document.title;u=location.href;e=document.selection?(document.selection.type!='None'?document.selection.createRange().text:''):(document.getSelection?document.getSelection():'');void(open('http://bookmark.hexun.com/post.aspx?title='+escape(t)+'&amp;url='+escape(u)+'&amp;excerpt='+escape(e),'HexunBookmark','scrollbars=no,width=600,height=450,left=80,top=80,status=no,resizable=yes'));\"><img alt=\"和讯网摘\" src=\"/images/share/hexun.gif\" border=\"0\" /></a>
    <a href=\"javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://my.poco.cn/fav/storeIt.php?t='+escape(d.title)+'&amp;u='+escape(d.location.href)+'&amp;c='+escape(t)+'&amp;img=http://www.h-strong.com/blog/logo.gif','keyit','scrollbars=no,width=475,height=575,status=no,resizable=yes'));keyit.focus();\"><img alt=\"POCO网摘\" src=\"/images/share/poco.gif\" border=\"0\" /></a>
    <a href=\"javascript:u=location.href;t=document.title;void(open('http://www.YouNote.com/NoteIt.aspx?u='+escape(u)+'&amp;t='+escape(t)+'&amp;c='+escape(document.selection.createRange().text),'网络书签', 'toolbar=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));\"><img alt=\"YouNote网摘\" src=\"/images/share/younote.gif\" border=\"0\" /></a>
    <a href=\"javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(blog=window.open('http://www.bolaa.com/CommendBlog/SmallLogin.aspx?title='+escape(d.title)+'&amp;newspath='+escape(d.location.href)+'&amp;subtitle='+escape(t),'bolaa','width=400px,height=400px'));blog.focus();\"><img alt=\"博拉网\" src=\"/images/share/bolaa.gif\" border=\"0\" /></a>
    <a href=\"javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.cn3.cn/user/addurl.asp?t='+escape(d.title)+'&amp;u='+escape(d.location.href)+'&amp;c='+escape(t),'keyit','scrollbars=no,width=490,height=450,left=120,top=50,status=no,resizable=yes'));keyit.focus();\"><img alt=\"天下图摘\" src=\"/images/share/cn3.gif\" border=\"0\" /></a>
    <a href=\"javascript:location.href='http://www.spurl.net/spurl.php?v=3&amp;title='+encodeURIComponent(document.title)+'&amp;url='+encodeURIComponent(location.href)\"> <img alt=\"spurl\" src=\"/images/share/spurl.png\" border=\"0\" /></a>
    <a href=\"javascript:location.href='http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)\"> <img alt=\"blogmarks\" src=\"/images/share/blogmarks.png\" border=\"0\" /></a>
    <a href=\"javascript:location.href='http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description='+encodeURIComponent(document.title)+'&amp;Url='+encodeURIComponent(location.href)+'&amp;Title='+encodeURIComponent(document.title)\"><img alt=\"BlinkList\" src=\"/images/share/blinklist.gif\" border=\"0\" /></a>
    <a href=\"javascript:location.href='http://reddit.com/submit?url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)\"><img alt=\"reddit\" src=\"/images/share/reddit.png\" border=\"0\" /></a>
    <a href=\"javascript:location.href='http://digg.com/submit?phase=2&amp;url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)\"><img alt=\"digg\" src=\"/images/share/digg.png\" border=\"0\" /></a>
    <a href=\"javascript:location.href='http://del.icio.us/post?&amp;url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title)\"><img alt=\"Del.icio.us\" src=\"/images/share/delicious.gif\" border=\"0\" /></a></div>";

接着把我下面的一排图片保存下来,放在 share 文件夹里,然后全部上传到joomla根目录的 /images/下面就可以了.

 
单元页面罗列出所有分类的最新10个条目 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-04-11 | View Count View: 18518 | Digg Count Digg: 83

默认只显示 标题, 条目数及描述. 其实本站很早就改了.... 象最新文章模块一样的效果...

今天抽时间整理出来死送给论坛里急要的朋友:

 

方法: /components/com_content/content.html.php [~137行开始, 搜 function showCategories 就可以了]

 

将此段..

  /**
 * Display links to categories
 */
 function showCategories( &$params, &$items, $gid, &$other_categories, $catid, $id, $Itemid ) {
  if(!count($other_categories)) return;
  ?>
  <ul>
  <?php
  foreach ( $other_categories as $row ) {
   $row->name = htmlspecialchars( stripslashes( ampReplace( $row->name ) ), ENT_QUOTES );
   if ( $catid != $row->id ) {
    ?>
    <li>
     <?php
     if ( $row->access <= $gid ) {
      $link = sefRelToAbs( 'index.php?option=com_content&amp;task=category&amp;sectionid='. $id .'&amp;id='. $row->id .'&amp;Itemid='. $Itemid );
      ?>
      <a href="<?php echo $link; ?>" class="category">
       <?php echo $row->name;?></a>
      <?php
      if ( $params->get( 'cat_items' ) ) {
       ?>
       &nbsp;<i>( <?php echo $row->numitems; echo _CHECKED_IN_ITEMS;?> )</i>
       <?php
      }
 
      // Writes Category Description
      if ( $params->get( 'cat_description' ) && $row->description ) {
       ?>
       <br />
       <?php
       echo $row->description;
      }
     } else {
      echo $row->name;
      ?>
      <a href="<?php echo sefRelToAbs( 'index.php?option=com_registration&amp;task=register' ); ?>">
       ( <?php echo _E_REGISTERED; ?> )</a>
      <?php
     }
     ?>
    </li>
    <?php
   }
  }
  ?>
  </ul>
  <?php
 }

 

 

替换为:

 /**
 * Display links to categories
 */
 function showCategories( &$params, &$items, $gid, &$other_categories, $catid, $id, $Itemid ) {
        global $database, $mainframe;
  if(!count($other_categories)) return;
  foreach ( $other_categories as $row ) {
   $row->name = htmlspecialchars( stripslashes( ampReplace( $row->name ) ), ENT_QUOTES );
   if ( $catid != $row->id ) {
     if ( $row->access <= $gid ) {
      $link = sefRelToAbs( 'index.php?option=com_content&amp;task=category&amp;sectionid='. $id .'&amp;id='. $row->id .'&amp;Itemid='. $Itemid );
      ?>
      <h3><a href="<?php echo $link; ?>"><?php echo $row->name;?>
      <?php if ( $params->get( 'cat_items' ) ) { ?>&nbsp;<i>( <?php echo $row->numitems; echo _CHECKED_IN_ITEMS;?> )</i>
      <?php }
      echo "</a></h3>";
      // Writes Category Description
      if ( $params->get( 'cat_description' ) && $row->description ) {
       echo $row->description;
      }
 
    echo "<ul class=\"latestnews-grey\">";
    $query1="SELECT a.id, a.title"
      . "\n FROM #__content AS a"
      . "\n WHERE catid='". $row->id ."'"
      . "\n AND a.state = 1"
      . "\n ORDER BY a.created DESC LIMIT 10";
    $database->setQuery( $query1 );
    $rows = $database->loadObjectList();
 
    $bs         = $mainframe->getBlogSectionCount();
    $bc         = $mainframe->getBlogCategoryCount();
    $gbs         = $mainframe->getGlobalBlogSectionCount();
    foreach ( $rows as $row ) {
      $Itemid = $mainframe->getItemid( $row->id, 0, 0, $bs, $bc, $gbs );
      if ($Itemid == NULL) {
        $Itemid = '';
      } else {
        $Itemid = '&Itemid='. $Itemid;
      }
      $link = sefRelToAbs( 'index.php?option=com_content&task=view&id='. $row->id . $Itemid );
  ?>
    <li class="latestnews-grey"><a href="<?php echo $link; ?>" class="latestnews<?php echo $class_sfx; ?>"><?php echo $row->title; ?></a></li>
    <?php } 
     } else {
      echo $row->name;
      ?>
      <a href="<?php echo sefRelToAbs( 'index.php?option=com_registration&amp;task=register' ); ?>">
       ( <?php echo _E_REGISTERED; ?> )</a>
      <?php
     }
    echo "</ul>";
   }
  }
 }

这样的话, 效果就是: 标题,条目数, 描述,最新10条, .... 下一单元重复...

要改 10 条为其他的话, 改上面的  a.created DESC LIMIT 10"; 里的 10 就可以了.

效果图就帖论坛了.....

end. 吃饭去...

 
joomla 1.0.12 问题集 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-03-12 | View Count View: 21295 | Digg Count Digg: 86

1: 在首页上, 文章里的阅读更多出现 Itemid 错误的问题

方法: 编辑  components/com_content/content.html.php

约400行左右

$_Itemid = $Itemid;

替换为:

$_Itemid = $mainframe->getItemid( $rows[$i]->id, 0, 0  );

约556行左右

$row->_Itemid = $Itemid;

替换为:

if ( $task != 'view' && $task != 'category' ) {
     $row->_Itemid = $mainframe->getItemid( $row->id, 0, 0 );
} else {
     $row->_Itemid = $Itemid;
}

2: [评论里2楼的 july 提供 ]建立 "List - Content Section"类型菜单,设置 “Empty Categories in Section”时,得不到预期效果:将空的Category也显示出来 这主要是由于SQL语句的Left Join 造成的,Left Join没有匹配的,会自动赋值为NULL(b.access 字段), 最后SQL语句执行时为 数值和NULL 的比较。解决的办法如下:  

components/com_content/content.php [~344行 ]

$access_check_content = "\n AND b.access <= " . (int) $gid;

替换为:

$access_check_content   = "\n AND ( b.access <= " . (int) $gid ." OR b.access is null)";

3: 后台增加菜单时, 查询次数上千次问题的解决方法:

/administrator/components/com_menus/content_item_link.class.php

将:

 $query = "SELECT a.id AS value, a.title AS text, a.sectionid, a.catid "
. "\n FROM #__content AS a"
. "\n INNER JOIN #__categories AS c ON a.catid = c.id"
. "\n INNER JOIN #__sections AS s ON a.sectionid = s.id"
. "\n WHERE a.state = 1"
. "\n ORDER BY a.sectionid, a.catid, a.title"
;
$database->setQuery( $query );
$contents = $database->loadObjectList( );
 
foreach ( $contents as $content ) {
$query = "SELECT s.title"
. "\n FROM #__sections AS s"
. "\n WHERE s.scope = 'content'"
. "\n AND s.id = " . (int) $content->sectionid
;
$database->setQuery( $query );
$section = $database->loadResult();
 
$query = "SELECT c.title"
. "\n FROM #__categories AS c"
. "\n WHERE c.id = " . (int) $content->catid
;
$database->setQuery( $query );
$category = $database->loadResult();
 
$value = $content->value;
$text = $section ." - ". $category ." / ". $content->text ."&nbsp;&nbsp;&nbsp;&nbsp;";
 
$temp[] = mosHTML::makeOption( $value, $text );
$contents = $temp;
}

替换为:

$query = 'SELECT a.id AS value, CONCAT(s.title, \' - \',c.title,\' / \',a.title, \'&nbsp;&nbsp;&nbsp;&nbsp;\') AS text
  FROM #__content AS a
  INNER JOIN #__categories AS c ON a.catid = c.id
  INNER JOIN #__sections AS s ON a.sectionid = s.id AND s.scope = \'content\'
  WHERE a.state = 1
  ORDER BY a.sectionid, a.catid, a.title';
$database->setQuery($query);
$contents = $database->loadObjectList();

4:两个未过滤的标题的地方:

/components/com_content/content.html.php [~607, 614行]

搜:

<?php echo $row->title;?>

替换为:

<?php echo htmlentities($row->title);?>

5:...

 

 

 
补遗: 随心所欲的自定义joomla模板的方法 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-03-09 | View Count View: 18109 | Digg Count Digg: 87

上一篇的 "随心所欲的自定义joomla模板的方法 " 或许是写的不够明确的缘故让不少人产生误解, 其实就是判断的地方的问题.比较容易理解的, 就是直接用未做sef的链接上的变量都可以做判断的条件, 并不只是 $option ! 其实在 "自定义任意分类里文章上横幅图片的显示 : http://www.autoit.cn/index.php/content/view/93/25.html " 一文里也写的明白. 当然其他地方也写只是没特意说明而已.

比如 "index.php?option=com_joomlaboard&Itemid=2&func=post&do=reply&catid=2" 及 "index.php?option=com_content&task=view&id=16&Itemid=1"

可以使用 $option, $Itemid, $func, $do, $catid, $task, $id 来做判断依据.


简单列举如下:

1a:

 <?php if ($option !="com_frontpage") mosMainBody(); ?>

1b:

<?php if ($option =="com_frontpage"){ ?>
   .....
<?php } ?>

2 :

<?php if ($Itemid =="1" && $task=="blogcategory") {?>
     <img src=.......
<?php }?>

3:

<?php if ($Itemid =="1" && $task =="view") {
      switch ( $id){ 
       case "2":  
         echo "...";
         break;
       case "3":  
         echo "...";
         break;
       case "4":  
         echo "...";
         break;
      }
}?>

End by Autoit.

 
显示站点 Pr 值的最简单又通用的方法 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2007-01-29 | View Count View: 21465 | Digg Count Digg: 116

直接调用一个图片的方法: [本站调用效果:PageRank 是 Google 对此网页重要性的评估]

<img src="http://pagerank.webmasterhome.cn/myrank/?s=1&url=http://www.autoit.cn" >

或者:

<img src="http://www.thegooglepagerank.com/pagerank.php?url=http://www.autoit.cn">

或者:

<img src="http://www.thegooglepagerank.com/pagerank.php?url=http://www.autoit.cn&img=2">

把里面的 www.autoit.cn 换成你的就可以了.

 

这个地址反应速度不错. 特分享出来.

因为是直接用 img 方式来的.所以调用都是很通用...

 

在很多支持 ubb,dz!的签名里也可以贴, 形式是:

[img]http://pagerank.webmasterhome.cn/myrank/?s=1&url=http://www.autoit.cn/[/img] 

如果自己使用的话,这个看上去显的一般,这里有个 flash 的,用的人不少,你可以看看. 

End. by Autoit.

 

 
« First « 1 2 3 4 5 6 7 8 9 10 » Last »

11 - 15 / 109