Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 2 Ответов
  • 2028 Просмотров
*

ursus102

  • Новичок
  • 3
  • 0 / 0
Как подключить jQeury?
« : 10.03.2013, 01:08:00 »
У меня стоит шаблон Pace от студии Yootheme для Joomla 2.5.
Нашел в сети скрипт, который создает турнирную сетку на сайте.
В архиве 2 папки (css и js) и 2 файла (один brackets.php и второй db_dump.txt).
Вопрос: Как мне все это прилепить к своему сайту? Прошу писать как можно подробнее, т.к. я профан в этом вопросе.

Я пытался сделать так:
1. Установил плагин JQuery + + Integrator
2. Включил его через АЦ Joomla.
3. Папки CSS и js из архива залил в .../templates/yoo_pace/css(js соответственно)
4. Копирую содержимое файла brackets.php и пытаюсь привязать к файлу .../templates/yoo_pace/index.php, но (!) index.php какой-то урезанный, ссылается на другие php файлы. К сожалению php не мой конек и разобраться я самостоятельно в этом не смогу. Насколько я понимаю, то привязка должна идти где-то еще, либо вообще в другом файле.

Содержимое brackets.php (Значения БД вставлял свои):
Код
<?php
$DBHOST = "localhost"; //mysql host name
$DBUSER = "username"; //database username
$DBPASS = "password"; //database password
$DBNAME = "bracket_db"; //database name

//Connect to MySQL
mysql_connect($DBHOST, $DBUSER, $DBPASS) or die(mysql_error());
//Connect to database
mysql_select_db($DBNAME) or die(mysql_error());
?>

<html>
<head>
<title>jQuery Tournament Brackets</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.bracket.js"></script>
<script type="text/javascript" src="js/jquery.json-2.3.min.js"></script>

<?php
if($_GET['tid'])
{
  $q = "SELECT * FROM lan_brackets WHERE tid = " . $_GET['tid'];
  $r = mysql_query($q) or die(mysql_error());
  $data = mysql_fetch_assoc($r);
  $json = $data['json'];
  if(!empty($json))
    echo '<script type="text/javascript">var autoCompleteData = '.$json.'</script>';
  else
    echo '<script type="text/javascript">var autoCompleteData = {
    teams : [["Devon", ""],["", ""]], results : []}</script>';
}
else
    echo '<script type="text/javascript">var autoCompleteData = {
    teams : [["Devon", ""],["", ""]], results : []}</script>';



if($_GET['secretMode'] == "inlanadminmode")
{ ?>
<script type="text/javascript" src="js/brackets.js"></script>
<?php }
else
{ ?>
<script type="text/javascript" src="js/brackets-rd.js"></script>
<?php } ?>




<link rel="stylesheet" type="text/css" href="css/jquery.bracket.css" />
</head>
<body>

<?php
if($_GET['secretMode'] == "inlanadminmode")
{
$q = "SELECT * FROM lan_tournaments";
$r = mysql_query($q) or die(mysql_error());
while($data = mysql_fetch_assoc($r))
{
  echo '<a href="brackets.php?secretMode=inlanadminmode&tid='.$data['id'].'">'.$data['name'].'</a><br />';
}
}
?>


<div id="autoComplete"></div>
<?php

if($_POST['data'] && $_GET['tid'] != 0 && $_GET['secretMode'] == "inlanadminmode")
{
  $tid = $_GET['tid'];
  $json = $_POST['data'];
  
  $q = "SELECT * FROM lan_brackets WHERE tid = " . $tid;
  $r = mysql_query($q) or die(mysql_error());
  
  if(mysql_num_rows($r) == 0)
    $q = "INSERT INTO lan_brackets (tid, json)
          VALUES ('".$tid."', '".$json."')";
  else
    $q = "UPDATE lan_brackets SET json = '".$json."' WHERE tid = " . $tid;
    
  $r = mysql_query($q) or die(mysql_error());
}

?>

</body>
</html>

Содержимое db_dump.txt:
Код
-- phpMyAdmin SQL Dump
-- version 3.4.3.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 13, 2012 at 12:18 PM
-- Server version: 5.0.77
-- PHP Version: 5.3.3

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `boss_phalox_lan`
--

-- --------------------------------------------------------

--
-- Table structure for table `lan_brackets`
--

DROP TABLE IF EXISTS `lan_brackets`;
CREATE TABLE IF NOT EXISTS `lan_brackets` (
  `id` int(11) NOT NULL auto_increment,
  `tid` int(11) NOT NULL,
  `json` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;

--
-- Dumping data for table `lan_brackets`
--

INSERT INTO `lan_brackets` (`id`, `tid`, `json`) VALUES
(2, 1, '{"teams":[["Devon","Toon"],["Jonas","Didi"],["Jos","Tom"],["Jan","Jef"]],"results":[[[[10,3],[5,3],[18,7],[19,4]],[[7,9],[3,8]],[[35,2],[7,2]]]]}'),
(3, 3, '{"teams":[["rtrst","hystfh"],["Joske",""]],"results":[[[[0,0],[0,null]],[[null,null],[null,null]]]]}'),
(4, 5, '{"teams":[["Devon",""],["",""]],"results":[[[[0,null],[null,null]],[[null,null],[null,null]]]]}'),
(6, 4, '{"teams":[["Devon",""],["",""]],"results":[[[[0,null],[null,null]],[[null,null],[null,null]]]]}');

-- --------------------------------------------------------

--
-- Table structure for table `lan_tournaments`
--

DROP TABLE IF EXISTS `lan_tournaments`;
CREATE TABLE IF NOT EXISTS `lan_tournaments` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `lan_tournaments`
--

INSERT INTO `lan_tournaments` (`id`, `name`) VALUES
(1, 'Team Fortress 2'),
(2, 'Unreal Tournament 2004'),
(3, 'Trackmania Nations');

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Содержимое index.php, в который я пытался вставить содержимое brackets.php:

Код
<?php
/**
* @package   yoo_pace
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

// include config
include_once(dirname(__FILE__).'/config.php');

// get warp
$warp = Warp::getInstance();

// load main template file, located in /layouts/template.php
echo $warp['template']->render('template');







Прошу помочь разобраться в моем вопросе.
Спасибо.
*

ursus102

  • Новичок
  • 3
  • 0 / 0
Re: Как подключить jQeury?
« Ответ #1 : 10.03.2013, 01:37:13 »
Вставил содержимое файла brackets.php в .../layout/template.php
Судя по исходному коду, то все подключилось успешно.
Но меня не устраивает порядок.
Т.е. я взял, тупо вставил содержимое brackets.php перед содержимым файла template.php.
Теперь в исходном коде вот такая картина:
Код
<html>
<head>
<title>jQuery Tournament Brackets</title>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.bracket.js"></script>
<script type="text/javascript" src="/js/jquery.json-2.3.min.js"></script>

<script type="text/javascript">var autoCompleteData = {
    teams : [["Devon", ""],["", ""]], results : []}</script><script type="text/javascript" src="/js/brackets-rd.js"></script>




<link rel="stylesheet" type="text/css" href="/css/jquery.bracket.css" />
</head>
<body>



<div id="autoComplete"></div>

</body>
</html>






















<!DOCTYPE HTML>
<html lang="ru-ru" dir="ltr">

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
  <base href="http://domen.ru/" />
  <meta name="author" content="Super User" />
  <meta name="generator" content="Joomla! - Open Source Content Management" />
  <title>MySite</title>
  <link href="http://domen.ru/index.php/component/search/?format=opensearch" rel="search" title="Искать MySite" type="application/opensearchdescription+xml" />
  <link href="/templates/yoo_pace/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
  <link rel="stylesheet" href="/cache/widgetkit/widgetkit-26bbbbe3.css" type="text/css" />
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
  <script src="/plugins/system/jqueryintegrator/jqueryintegrator/jquery.noconflict.js" type="text/javascript"></script>
  <script src="/media/system/js/mootools-core.js" type="text/javascript"></script>
  <script src="/media/system/js/core.js" type="text/javascript"></script>
  <script src="/media/system/js/caption.js" type="text/javascript"></script>
  <script src="/media/system/js/mootools-more.js" type="text/javascript"></script>
  <script src="/media/widgetkit/js/jquery.js" type="text/javascript"></script>
  <script src="/cache/widgetkit/widgetkit-24b55ec0.js" type="text/javascript"></script>
  <script type="text/javascript">
window.addEvent('load', function() {
new JCaption('img.caption');
});
window.addEvent('domready', function() {
$$('.hasTip').each(function(el) {
var title = el.get('title');
if (title) {
var parts = title.split('::', 2);
el.store('tip:title', parts[0]);
el.store('tip:text', parts[1]);
}
});
var JTooltips = new Tips($$('.hasTip'), { maxTitleChars: 50, fixed: false});
});
  </script>

<link rel="apple-touch-icon-precomposed" href="/templates/yoo_pace/apple_touch_icon.png" />
<link rel="stylesheet" href="/templates/yoo_pace/css/base.css

Как выровнять все это дело?
Куда правильно вставить содержимое brackets.php, чтобы все было ровно и красиво?

Содержимое файла template.php до моих экзекуций:
Код
<?php
/**
* @package   yoo_pace
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
*/

// get template configuration
include($this['path']->path('layouts:template.config.php'));

?>
<!DOCTYPE HTML>
<html lang="<?php echo $this['config']->get('language'); ?>" dir="<?php echo $this['config']->get('direction'); ?>">

<head>
<?php echo $this['template']->render('head'); ?>
</head>

<body id="page" class="page <?php echo $this['config']->get('body_classes'); ?>" data-config='<?php echo $this['config']->get('body_config','{}'); ?>'>

<div id="page-bg">

<?php if ($this['modules']->count('absolute')) : ?>
<div id="absolute">
<?php echo $this['modules']->render('absolute'); ?>
</div>
<?php endif; ?>

<div class="wrapper clearfix">

<header id="header">

<?php if ($this['modules']->count('toolbar-l + toolbar-r + search') || $this['config']->get('date')) : ?>
<div id="toolbar" class="clearfix">

<?php if ($this['modules']->count('toolbar-l') || $this['config']->get('date')) : ?>
<div class="float-left">

<?php if ($this['config']->get('date')) : ?>
<time datetime="<?php echo $this['config']->get('datetime'); ?>"><?php echo $this['config']->get('actual_date'); ?></time>
<?php endif; ?>

<?php echo $this['modules']->render('toolbar-l'); ?>

</div>
<?php endif; ?>

<?php if ($this['modules']->count('search')) : ?>
<div id="search"><?php echo $this['modules']->render('search'); ?></div>
<?php endif; ?>

<?php if ($this['modules']->count('toolbar-r')) : ?>
<div class="float-right"><?php echo $this['modules']->render('toolbar-r'); ?></div>
<?php endif; ?>

</div>
<?php endif; ?>

<?php if ($this['modules']->count('logo + headerbar')) : ?>
<div id="headerbar" class="clearfix">

<?php if ($this['modules']->count('logo')) : ?>
<a id="logo" href="<?php echo $this['config']->get('site_url'); ?>"><?php echo $this['modules']->render('logo'); ?></a>
<?php endif; ?>

<?php echo $this['modules']->render('headerbar'); ?>

</div>
<?php endif; ?>

<?php if ($this['modules']->count('banner')) : ?>
<div id="banner"><?php echo $this['modules']->render('banner'); ?></div>
<?php endif; ?>

</header>

<?php if ($this['modules']->count('menu')) : ?>
<nav id="menu"><?php echo $this['modules']->render('menu'); ?></nav>
<?php endif; ?>

<div id="block-main" class="clearfix">
<div>

<?php if ($this['modules']->count('top-a')) : ?>
<section id="top-a" class="grid-block"><?php echo $this['modules']->render('top-a', array('layout'=>$this['config']->get('top-a'))); ?></section>
<?php endif; ?>

<?php if ($this['modules']->count('top-b')) : ?>
<section id="top-b" class="grid-block"><?php echo $this['modules']->render('top-b', array('layout'=>$this['config']->get('top-b'))); ?></section>
<?php endif; ?>

<?php if ($this['modules']->count('innertop + innerbottom + sidebar-a + sidebar-b') || $this['config']->get('system_output')) : ?>
<div id="main" class="grid-block">

<div id="maininner" class="grid-box">

<?php if ($this['modules']->count('innertop')) : ?>
<section id="innertop" class="grid-block"><?php echo $this['modules']->render('innertop', array('layout'=>$this['config']->get('innertop'))); ?></section>
<?php endif; ?>

<?php if ($this['modules']->count('breadcrumbs')) : ?>
<section id="breadcrumbs"><?php echo $this['modules']->render('breadcrumbs'); ?></section>
<?php endif; ?>

<?php if ($this['config']->get('system_output')) : ?>
<section id="content" class="grid-block"><?php echo $this['template']->render('content'); ?></section>
<?php endif; ?>

<?php if ($this['modules']->count('innerbottom')) : ?>
<section id="innerbottom" class="grid-block"><?php echo $this['modules']->render('innerbottom', array('layout'=>$this['config']->get('innerbottom'))); ?></section>
<?php endif; ?>

</div>
<!-- maininner end -->

<?php if ($this['modules']->count('sidebar-a')) : ?>
<aside id="sidebar-a" class="grid-box"><?php echo $this['modules']->render('sidebar-a', array('layout'=>'stack')); ?></aside>
<?php endif; ?>

<?php if ($this['modules']->count('sidebar-b')) : ?>
<aside id="sidebar-b" class="grid-box"><?php echo $this['modules']->render('sidebar-b', array('layout'=>'stack')); ?></aside>
<?php endif; ?>

</div>
<?php endif; ?>
<!-- main end -->

<?php if ($this['modules']->count('bottom-a')) : ?>
<section id="bottom-a" class="grid-block"><?php echo $this['modules']->render('bottom-a', array('layout'=>$this['config']->get('bottom-a'))); ?></section>
<?php endif; ?>

<?php if ($this['modules']->count('bottom-b')) : ?>
<section id="bottom-b" class="grid-block"><?php echo $this['modules']->render('bottom-b', array('layout'=>$this['config']->get('bottom-b'))); ?></section>
<?php endif; ?>

<?php if ($this['modules']->count('footer + debug') || $this['config']->get('warp_branding') || $this['config']->get('totop_scroller')) : ?>
<footer id="footer">

<?php if ($this['config']->get('totop_scroller')) : ?>
<a id="totop-scroller" href="#page"></a>
<?php endif; ?>

<?php
echo $this['modules']->render('footer');
$this->output('warp_branding');
echo $this['modules']->render('debug');
?>

</footer>
<?php endif; ?>
</div>
</div>
</div>

<?php echo $this->render('footer'); ?>

</div>

</body>
</html>
*

ursus102

  • Новичок
  • 3
  • 0 / 0
Re: Как подключить jQeury?
« Ответ #2 : 10.03.2013, 01:48:19 »
Нет, наверное, все же, не все подключилось успешно. Даже не пойму как проверить, т.к. еще не разобрался как пользоваться.
Знающие люди - откликнетесь :)
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Как подключить библиотеку Joomla в свой php файл?

Автор kowap

Ответов: 5
Просмотров: 6090
Последний ответ 13.02.2016, 13:49:55
от buyanov
Как правильно подключить jquery к Joomla 2.5?

Автор digitalheart

Ответов: 10
Просмотров: 14189
Последний ответ 05.06.2015, 11:29:13
от Jekssone
Как найти файл страницы печати ? или как подключить configuration.php к своему шаблону?

Автор webmetrica

Ответов: 5
Просмотров: 1098
Последний ответ 15.04.2015, 15:35:19
от webmetrica
Подключить скрипты только на блоге

Автор Ivankalikemanka

Ответов: 3
Просмотров: 923
Последний ответ 16.02.2014, 17:46:33
от Shustry
Как подключить стандартный Joomla CSS ?

Автор Oggy

Ответов: 4
Просмотров: 4751
Последний ответ 10.01.2014, 07:48:57
от Kukush