Форум SAPE.RU

Форум SAPE.RU (http://forum.sape.ru/index.php)
-   Установка кода на различные движки (http://forum.sape.ru/forumdisplay.php?f=26)
-   -   Код в виджетах (http://forum.sape.ru/showthread.php?t=42784)

andreas12 04.12.2009 20:33

Код в виджетах
 
Подскажите пожалуйста, как поставить код сапе в виджеты, например в обл. тэгов...

Warchild 04.12.2009 20:39

<?php
if (!defined('_SAPE_USER')) {
define('_SAPE_USER', 'ВАШ КОД');
}
require_once($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php');
$o['charset'] = 'UTF-8';
$sape = new SAPE_client($o);
echo $sape->return_links();
unset($o);
?>

Это вставляете в файл виджета и все. Под конец, там уже посмотрите.

zhegloff 04.12.2009 20:42

Цитата:

Сообщение от andreas12 (Сообщение 646297)
Подскажите пожалуйста, как поставить код сапе в виджеты, например в обл. тэгов...

открыть код виджета, добавить туда код сапы, сохранить, закрыть код виджета.

andreas12 05.12.2009 02:41

А в каком(их) файле(ах) обычно находятся коды виджетов???

aweksa 05.12.2009 13:46

Цитата:

Сообщение от andreas12 (Сообщение 646762)
А в каком(их) файле(ах) обычно находятся коды виджетов???

Предполагаю, что это зависит от CMS ))

andreas12 05.12.2009 14:55

Допустим я нашел файл с виджетами! выглядит он след образом:

<?php

# WIDGET: Left Sidebar
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Left Sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h3>',
'after_title' => '</h3>',
));

# WIDGET: Right Sidebar
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Right Sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h3>',
'after_title' => '</h3>',
));

# Displays a list of pages
function sky_list_pages() {
global $wpdb;
$querystr = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page' ORDER BY $wpdb->posts.post_title ASC";
$pageposts = $wpdb->get_results($querystr, OBJECT);
if ($pageposts) {
foreach ($pageposts as $post) {
?><li><a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a></li><?php
}
}
}

# Displays a list of popular posts
function sky_popular_posts($num) {
global $wpdb;
$querystr = "SELECT $wpdb->posts.post_title, $wpdb->posts.comment_count, $wpdb->posts.ID FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' ORDER BY $wpdb->posts.comment_count DESC LIMIT $num";
$popposts = $wpdb->get_results($querystr, OBJECT);
if (count($popposts)>0) {
$count = 0;
foreach ($popposts as $post) {
$count++;
$class = 'item';
if ($count==$num) $class = 'last';
?><li><a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a></li><?php
}
}
}

# Displays a list of recent posts
function sky_recent_posts($num, $pre='<li>', $suf='</li>', $excerpt=false, $home=false) {
global $post;
$myposts = get_posts('numberposts='.$num.'&order=DESC&orderby =post_date');
foreach($myposts as $post) {
if ($home) the_post();
echo $pre;
?><a href="<?php the_permalink() ?>"><?php the_title(); ?></a><?php
echo $suf;
}
}

# Displays a list of recent categories
function sky_recent_comments($num, $pre='<li>', $suf='</li>')
{
global $wpdb, $post;
$querystr = "SELECT $wpdb->comments.comment_ID, $wpdb->comments.comment_post_ID, $wpdb->comments.comment_author FROM $wpdb->comments WHERE $wpdb->comments.comment_approved=1 ORDER BY $wpdb->comments.comment_date DESC LIMIT $num";
$recentcomments = $wpdb->get_results($querystr, OBJECT);
foreach ($recentcomments as $rc) {
$post = get_post($rc->comment_post_ID);
echo $pre;
?><a href="<?php the_permalink() ?>#comment-<?php echo $rc->comment_ID ?>"><strong><?php echo $rc->comment_author; ?></strong> on "<?php echo the_title(); ?>"</a><?php



echo $suf;
}

}

# Displays the comment authors gravatar if available
function sky_gravatar($size=50) {
global $comment, $settings;
ob_start();
comment_author_email();
$gravatar_url = 'http://www.gravatar.com/avatar/' . md5(strtolower(ob_get_clean())) . '?s=' . $size . '&amp;d=monsterid'
?><img alt="avatar" src="<?php echo $gravatar_url; ?>" class="gravatar" /><?php
}

?>

называется он function.php

куда мне вставить код сапы, чтобы проиндексировались в сапе эти пресловутые облака тегов,добавленные в сайтбар, сапа их напрочь отказывается видеть!!!

Добавлено через 25 минут
хотя в этом файле не нашел функции отвечающей за обл. тэгов


Часовой пояс GMT +3, время: 22:49.

Работает на vBulletin® версия 3.8.7.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Перевод: zCarot
SAPE.RU — система купли-продажи ссылок с главных и внутренних страниц сайтов.