COMMUNITY FORUM
K 2 not insert the banner code
- Anastasia
-
Topic Author
- Offline
- New Member
Less
More
8 years 8 months ago #158137
by Anastasia
K 2 not insert the banner code was created by Anastasia
Hello.
Made the code to insert banners in K 2.
On one site works and the other two do not! We can not understand the reason. It seems К 2 cut code....
Made the code to insert banners in K 2.
Warning: Spoiler!
<?php
function addContent($addTo, $add, $cntRep, $after = '</p>', $openTag = '<div align="center">', $closeTag = '</div>'){
$posAfter = 0;
for ($i=0; $i < $cntRep; $i++) {
$pos = stripos($addTo, $after, $posAfter);
$posAfter = $pos+strlen($after);
if($pos===FALSE){
return $addTo;
}
}
$beforeAdding = substr($addTo, 0, $posAfter);
$afterAdding = substr($addTo, $posAfter);
$result = $beforeAdding . $openTag . $add . $closeTag . $afterAdding;
return $result;
}
$this->item->fulltext = addContent($this->item->fulltext,'<div> ВАШ КОД </div>',5);
echo $this->item->fulltext;
?>
function addContent($addTo, $add, $cntRep, $after = '</p>', $openTag = '<div align="center">', $closeTag = '</div>'){
$posAfter = 0;
for ($i=0; $i < $cntRep; $i++) {
$pos = stripos($addTo, $after, $posAfter);
$posAfter = $pos+strlen($after);
if($pos===FALSE){
return $addTo;
}
}
$beforeAdding = substr($addTo, 0, $posAfter);
$afterAdding = substr($addTo, $posAfter);
$result = $beforeAdding . $openTag . $add . $closeTag . $afterAdding;
return $result;
}
$this->item->fulltext = addContent($this->item->fulltext,'<div> ВАШ КОД </div>',5);
echo $this->item->fulltext;
?>
On one site works and the other two do not! We can not understand the reason. It seems К 2 cut code....
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 8 months ago #158144
by Krikor Boghossian
Replied by Krikor Boghossian on topic K 2 not insert the banner code
How did you add this code,
did you add it in your overrides?
did you add it in your overrides?
Please Log in or Create an account to join the conversation.
- Anastasia
-
Topic Author
- Offline
- New Member
8 years 8 months ago #158171
by Anastasia
Replied by Anastasia on topic K 2 not insert the banner code
Hello
I add in FTP folder componetnt-K2-template-defoult-item
same like in sait ther work...
sorry i not understatn what mean "did you add it in your overrides?"
I add in FTP folder componetnt-K2-template-defoult-item
same like in sait ther work...
sorry i not understatn what mean "did you add it in your overrides?"
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 8 months ago #158173
by Krikor Boghossian
Replied by Krikor Boghossian on topic K 2 not insert the banner code
Please read this post, and make sure that you are a) using overrides, b) editing the correct file www.joomlaworks.net/blog/item/194-k2-inheritance-sub-templating
Please Log in or Create an account to join the conversation.