lostyazilim
tr.link

Kodlarda değişiklik yapmam gerekiyor

14 Mesajlar 2.071 Okunma
lstbozum
tr.link

RadiKaL RadiKaL WM Aracı Kullanıcı
  • Üyelik 08.12.2013
  • Yaş/Cinsiyet 40 / E
  • Meslek Çiftçi
  • Konum Bursa
  • Ad Soyad A** G**
  • Mesajlar 1304
  • Beğeniler 281 / 398
  • Ticaret 8, (%100)
/*
Question2Answer by Gideon Greenspan and contributors
http://www.question2answer.org/
Description: Default theme class, broken into lots of little functions for easy overriding
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
header('Location: ../');
exit;
}
/*
How do I make a theme which goes beyond CSS to actually modify the HTML output?
Create a file named qa-theme.php in your new theme directory which defines a class qa_html_theme
that extends this base class qa_html_theme_base. You can then override any of the methods below,
referring back to the default method using double colon (qa_html_theme_base::) notation.
Plugins can also do something similar by using a layer. For more information and to see some example
code, please consult the online Q2A documentation.
*/
class qa_html_theme_base
{
public $template;
public $content;
public $rooturl;
public $request;
public $isRTL; // (boolean) whether text direction is Right-To-Left
protected $minifyHtml; // (boolean) whether to indent the HTML
protected $indent = 0;
protected $lines = 0;
protected $context = array();
// whether to use new block layout in rankings (true) or fall back to tables (false)
protected $ranking_block_layout = false;
// theme 'slug' to use as CSS class
protected $theme;
/**
* Initialize the object and assign local variables.
* @param $template
* @param $content
* @param $rooturl
* @param $request
*/
public function __construct($template, $content, $rooturl, $request)
{
$this->template = $template;
$this->content = $content;
$this->rooturl = $rooturl;
$this->request = $request;
$this->isRTL = isset($content['direction']) && $content['direction'] === 'rtl';
$this->minifyHtml = !empty($content['options']['minify_html']);
}
/**
* @deprecated PHP4-style constructor deprecated from 1.7; please use proper `__construct`
* function instead.
* @param $template
* @param $content
* @param $rooturl
* @param $request
*/
public function qa_html_theme_base($template, $content, $rooturl, $request)
{
self::__construct($template, $content, $rooturl, $request);
}
/**
* Output each element in $elements on a separate line, with automatic HTML indenting.
* This should be passed markup which uses the form for unpaired tags, to help keep
* track of indenting, although its actual output converts these to for W3C validation.
* @param $elements
*/
public function output_array($elements)
{
foreach ($elements as $element) {
$line = str_replace('/>', '>', $element);
if ($this->minifyHtml) {
if (strlen($line))
echo $line . "\n";
} else {
$delta = substr_count($element, '<') - substr_count($element, '');
if ($delta < 0) {
$this->indent += $delta;
}
echo str_repeat("\t", max(0, $this->indent)) . $line . "\n";
if ($delta > 0) {
$this->indent += $delta;
}
}
$this->lines++;
}
}
/**
* Output each passed parameter on a separate line - see output_array() comments.
*/
public function output() // other parameters picked up via func_get_args()
{
$args = func_get_args();
$this->output_array($args);
}
/**
* Output $html at the current indent level, but don't change indent level based on the markup within.
* Useful for user-entered HTML which is unlikely to follow the rules we need to track indenting.
* @param $html
*/
public function output_raw($html)
{
if (strlen($html))
echo str_repeat("\t", max(0, $this->indent)) . $html . "\n";
}
/**
* Output the three elements ['prefix'], ['data'] and ['suffix'] of $parts (if they're defined),
* with appropriate CSS classes based on $class, using $outertag and $innertag in the markup.
* @param $parts
* @param $class
* @param string $outertag
* @param string $innertag
* @param string $extraclass
*/
public function output_split($parts, $class, $outertag = 'span', $innertag = 'span', $extraclass = null)
{
if (empty($parts) && strtolower($outertag) != 'td')
return;
$this->output(
'<' . $outertag . ' class="' . $class . (isset($extraclass) ? (' ' . $extraclass) : '') . '">',
(strlen(@$parts['prefix']) ? ('<' . $innertag . ' class="' . $class . '-pad">' . $parts['prefix'] . '') : '') .
(strlen(@$parts['data']) ? ('<' . $innertag . ' class="' . $class . '-data">' . $parts['data'] . '') : '') .
(strlen(@$parts['suffix']) ? ('<' . $innertag . ' class="' . $class . '-pad">' . $parts['suffix'] . '') : ''),
''
);
}
/**
* Set some context, which be accessed via $this->context for a function to know where it's being used on the page.
* @param $key
* @param $value
*/
public function set_context($key, $value)
{
$this->context[$key] = $value;
}
/**
* Clear some context (used at the end of the appropriate loop).
* @param $key
*/
public function clear_context($key)
{
unset($this->context[$key]);
}
/**
* Reorder the parts of the page according to the $parts array which contains part keys in their new order. Call this
* before main_parts(). See the docs for qa_array_reorder() in util/sort.php for the other parameters.
* @param $parts
* @param string $beforekey
* @param bool $reorderrelative
*/
public function reorder_parts($parts, $beforekey = null, $reorderrelative = true)
{
require_once QA_INCLUDE_DIR . 'util/sort.php';
qa_array_reorder($this->content, $parts, $beforekey, $reorderrelative);
}
/**
* Output the widgets (as provided in $this->content['widgets']) for $region and $place.
* @param $region
* @param $place
*/
public function widgets($region, $place)
{
$widgetsHere = isset($this->content['widgets'][$region][$place]) ? $this->content['widgets'][$region][$place] : array();
if (is_array($widgetsHere) && count($widgetsHere) > 0) {
$this->output('
');
foreach ($widgetsHere as $module) {
$this->output('
');
$module->output_widget($region, $place, $this, $this->template, $this->request, $this->content);
$this->output('
');
}
$this->output('
', '');
}
}
/**
* Pre-output initialization. Immediately called after loading of the module. Content and template variables are
* already setup at this point. Useful to perform layer initialization in the earliest and safest stage possible.
*/
public function initialize()
{
// abstract method
}
/**
* Post-output cleanup. For now, check that the indenting ended right, and if not, output a warning in an HTML comment.
*/
public function finish()
{
if ($this->indent !== 0 && !$this->minifyHtml) {
echo "\n";
}
}
// From here on, we have a large number of class methods which output particular pieces of HTML markup
// The calling chain is initiated from qa-page.php, or ajax/*.php for refreshing parts of a page,
// For most HTML elements, the name of the function is similar to the element's CSS class, for example:
// search() outputs
wmaraci
reklam

RadiKaL RadiKaL WM Aracı Kullanıcı
  • Üyelik 08.12.2013
  • Yaş/Cinsiyet 40 / E
  • Meslek Çiftçi
  • Konum Bursa
  • Ad Soyad A** G**
  • Mesajlar 1304
  • Beğeniler 281 / 398
  • Ticaret 8, (%100)
Acaba diyorum temanın kodlarını mı kurcalamak lazım. Çünkü başka tema deniyorum hata vermiyor.
 

 

MyYafes MyYafes Developer Kullanıcı
  • Üyelik 05.03.2015
  • Yaş/Cinsiyet 26 / E
  • Meslek Full-Stack Web Developer
  • Konum Ankara
  • Ad Soyad M** M**
  • Mesajlar 25
  • Beğeniler 0 / 7
  • Ticaret 0, (%0)
Şimdi o dosyandaki -> qa-theme-base.php kodları komple silip şu kodları yapıştır.

/*
Question2Answer by Gideon Greenspan and contributors
http://www.question2answer.org/
Description: Default theme class, broken into lots of little functions for easy overriding
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
header('Location: ../');
exit;
}
/*
How do I make a theme which goes beyond CSS to actually modify the HTML output?
Create a file named qa-theme.php in your new theme directory which defines a class qa_html_theme
that extends this base class qa_html_theme_base. You can then override any of the methods below,
referring back to the default method using double colon (qa_html_theme_base::) notation.
Plugins can also do something similar by using a layer. For more information and to see some example
code, please consult the online Q2A documentation.
*/
class qa_html_theme_base
{
public $template;
public $content;
public $rooturl;
public $request;
public $isRTL; // (boolean) whether text direction is Right-To-Left
protected $minifyHtml; // (boolean) whether to indent the HTML
protected $indent = 0;
protected $lines = 0;
protected $context = array();
// whether to use new block layout in rankings (true) or fall back to tables (false)
protected $ranking_block_layout = false;
// theme 'slug' to use as CSS class
protected $theme;
/**
* Initialize the object and assign local variables.
* @param $template
* @param $content
* @param $rooturl
* @param $request
*/
public function __construct($template, $content, $rooturl, $request)
{
$this->template = $template;
$this->content = $content;
$this->rooturl = $rooturl;
$this->request = $request;
$this->isRTL = isset($content['direction']) && $content['direction'] === 'rtl';
$this->minifyHtml = !empty($content['options']['minify_html']);
}
/**
* @deprecated PHP4-style constructor deprecated from 1.7; please use proper `__construct`
* function instead.
* @param $template
* @param $content
* @param $rooturl
* @param $request
*/
public function qa_html_theme_base($template, $content, $rooturl, $request)
{
self::__construct($template, $content, $rooturl, $request);
}
/**
* Output each element in $elements on a separate line, with automatic HTML indenting.
* This should be passed markup which uses the form for unpaired tags, to help keep
* track of indenting, although its actual output converts these to for W3C validation.
* @param $elements
*/
public function output_array($elements)
{
foreach ($elements as $element) {
$line = str_replace('/>', '>', $element);
if ($this->minifyHtml) {
if (strlen($line))
echo $line . "\n";
} else {
$delta = substr_count($element, '<') - substr_count($element, '');
if ($delta < 0) {
$this->indent += $delta;
}
echo str_repeat("\t", max(0, $this->indent)) . $line . "\n";
if ($delta > 0) {
$this->indent += $delta;
}
}
$this->lines++;
}
}
/**
* Output each passed parameter on a separate line - see output_array() comments.
*/
public function output() // other parameters picked up via func_get_args()
{
$args = func_get_args();
$this->output_array($args);
}
/**
* Output $html at the current indent level, but don't change indent level based on the markup within.
* Useful for user-entered HTML which is unlikely to follow the rules we need to track indenting.
* @param $html
*/
public function output_raw($html)
{
if (strlen($html))
echo str_repeat("\t", max(0, $this->indent)) . $html . "\n";
}
/**
* Output the three elements ['prefix'], ['data'] and ['suffix'] of $parts (if they're defined),
* with appropriate CSS classes based on $class, using $outertag and $innertag in the markup.
* @param $parts
* @param $class
* @param string $outertag
* @param string $innertag
* @param string $extraclass
*/
public function output_split($parts, $class, $outertag = 'span', $innertag = 'span', $extraclass = null)
{
if (empty($parts) && strtolower($outertag) != 'td')
return;
$this->output(
'<' . $outertag . ' class="' . $class . (isset($extraclass) ? (' ' . $extraclass) : '') . '">',
(strlen(@$parts['prefix']) ? ('<' . $innertag . ' class="' . $class . '-pad">' . $parts['prefix'] . '') : '') .
(strlen(@$parts['data']) ? ('<' . $innertag . ' class="' . $class . '-data">' . $parts['data'] . '') : '') .
(strlen(@$parts['suffix']) ? ('<' . $innertag . ' class="' . $class . '-pad">' . $parts['suffix'] . '') : ''),
''
);
}
/**
* Set some context, which be accessed via $this->context for a function to know where it's being used on the page.
* @param $key
* @param $value
*/
public function set_context($key, $value)
{
$this->context[$key] = $value;
}
/**
* Clear some context (used at the end of the appropriate loop).
* @param $key
*/
public function clear_context($key)
{
unset($this->context[$key]);
}
/**
* Reorder the parts of the page according to the $parts array which contains part keys in their new order. Call this
* before main_parts(). See the docs for qa_array_reorder() in util/sort.php for the other parameters.
* @param $parts
* @param string $beforekey
* @param bool $reorderrelative
*/
public function reorder_parts($parts, $beforekey = null, $reorderrelative = true)
{
require_once QA_INCLUDE_DIR . 'util/sort.php';
qa_array_reorder($this->content, $parts, $beforekey, $reorderrelative);
}
/**
* Output the widgets (as provided in $this->content['widgets']) for $region and $place.
* @param $region
* @param $place
*/
public function widgets($region, $place)
{
$widgetsHere = isset($this->content['widgets'][$region][$place]) ? $this->content['widgets'][$region][$place] : array();
if (is_array($widgetsHere) && count($widgetsHere) > 0) {
$this->output('
');
foreach ($widgetsHere as $module) {
$this->output('
');
$module->output_widget($region, $place, $this, $this->template, $this->request, $this->content);
$this->output('
');
}
$this->output('
', '');
}
}
/**
* Pre-output initialization. Immediately called after loading of the module. Content and template variables are
* already setup at this point. Useful to perform layer initialization in the earliest and safest stage possible.
*/
public function initialize()
{
// abstract method
}
/**
* Post-output cleanup. For now, check that the indenting ended right, and if not, output a warning in an HTML comment.
*/
public function finish()
{
if ($this->indent !== 0 && !$this->minifyHtml) {
echo "\n";
}
}
// From here on, we have a large number of class methods which output particular pieces of HTML markup
// The calling chain is initiated from qa-page.php, or ajax/*.php for refreshing parts of a page,
// For most HTML elements, the name of the function is similar to the element's CSS class, for example:
// search() outputs