try to run the system on its website from the link exchange. Exchange website sape.ru.
They require inserting php code on the instruction here:
To be able to display hypertext links on the pages of the site that you want to connect to the system, it is necessary at the beginning of the source code of these pages do the following php-box:
<?php
if (!defined('_SAPE_USER')){
define('_SAPE_USER', '***********myID***********');
}
require_once(realpath($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php'));
$sape = new SAPE_client();
?>
Further, in those places page where you want to display a link, insert the following code:
<? echo $sape->return_links($n); ?>
where $ n – the number of links you want to display in this spot on the page . The last call to this function, the document must be made with no parameters.
Example: Suppose you want to display on the page 5 links in 3 blocks, separated in different parts of the page, for example, one link under the left navigation menu, 2 links under the right menu and the remaining two links in the “footer” of the page. In this situation, you need to make the source code of the page 3 additional php-insert:
<? echo $sape->return_links(1); ?>– Under the left menu;
<? echo $sape->return_links(2); ?>– Under the right menu;
<? echo $sape->return_links(); ?>– In the “footer” (note the function is called with no parameters, because it is the last challenge of this page);
In that case, if the web site is going to series connection of multiple files (via include, require), or call any of the functions, then to call the code in these files or functions, you must define the variable $sape how to create a global client before use it.
That is, the initiation of the original client will look like:
<?php
global $sape;
if (!defined('_SAPE_USER')){
define('_SAPE_USER', '***********myID***********');
}
require_once(realpath($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php'));
$sape = new SAPE_client();
?>
and continued use (already inside the included file or in the body of the function):
<?php
global $sape;
echo $sape->return_links();
?>
my question is how to do it. I was trying to push in different places but there is no result. all subject to the standard rvbotaet without problems.
Hello,
i’ve made here some tests – add this at the end of your functions.php and use the [td_sape] shortcode where you want to output the links. (It can be used in sidebar text block and in text block in pagebuilder)
function td_sape_header() {
if (!class_exists(SAPE_client)) {
if (!defined('_SAPE_USER')){
define('_SAPE_USER', '***********myID***********');
}
require_once(realpath($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php'));
$sape = new SAPE_client();
}
}
function td_sape($atts, $content = null) {
add_action('wp_head', 'td_sape_header');
global $sape;
return $sape->return_links();
}
add_shortcode('td_sape', 'td_sape');
If it dosn’t work you can try this one:
function td_sape_header() {
if (!class_exists(SAPE_client)) {
if (!defined('_SAPE_USER')){
define('_SAPE_USER', '***********myID***********');
}
require_once(realpath($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php'));
$sape = new SAPE_client();
}
}
add_action('wp_head', 'td_sape_header');
function td_sape($atts, $content = null) {
global $sape;
return $sape->return_links();
}
add_shortcode('td_sape', 'td_sape');
hello,
try this:
function td_sape_header() {
global $sape;
if (!class_exists(SAPE_client)) {
if (!defined('_SAPE_USER')){
define('_SAPE_USER', '***********myID***********');
}
require_once(realpath($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php'));
$sape = new SAPE_client();
}
}
add_action('wp_head', 'td_sape_header');
function td_sape($atts, $content = null) {
global $sape;
return $sape->return_links();
}
add_shortcode('td_sape', 'td_sape');
I hope you understand that it’s a bit hard for me to write code in the blind without testing it with the actual thing. Sorry for the delay

