Solve the problem of phpcms replacing javascript slide code to call pictures, phpcmsjavascript
Today I found a js to be placed on phpcms! But his code is like this
Copy code The code is as follows:
var titles = 'Top 1|Top 2|Top 3|Top 4';
var imgs='{APP_PATH}cdstyle/images/image1.jpg|{APP_PATH}cdstyle/images/image2.jpg|{APP_PATH}cdstyle/images/image3.jpg|{APP_PATH}cdstyle/images/image4.jpg';
var urls='http://baby220818.gotoip2.com/|http://baby220818.gotoip2.com/|http://baby220818.gotoip2.com/|http://baby220818.gotoip2.com/';
You can only recognize this kind of problem. Today we will solve this problem. Here are my thoughts and code
Copy code The code is as follows:
var title = new Array(); //Declare the array first and load everything into the array
var img = new Array();
var url = new Array();
{pc:content action="position" posid="1" order="listorder DESC" thumb="1" num="5"}
{php $a=1;}
{loop $data $r}
title[{$a}] = "{$r['title']}"; //title[1]='heloo'
img[{$a}] ="{thumb($r['thumb'],295,225)}";
url[{$a}] ="{$r['url']}";
{php $a++;}
{/loop}
{/pc}
var files = "";
var links = "";
var texts = "";
for(i=1;i
if(files=="") files = img[i]; //If files=empty, assign files == img[1] and then +| +img[2] Finally, the above format will be output
else files += "|"+img[i];
}
for(i=1;i
if(links=="") links = url[i];
else links += "|"+url[i];
}
for(i=1;i
if(texts=="") texts = title[i];
else texts += "|"+title[i];
}
var titles = texts; //Assignment
var imgs= files;
var urls=links;
This is actually very simple, mainly a matter of thinking.
http://www.bkjia.com/PHPjc/933599.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/933599.htmlTechArticleTo solve the problem of phpcms replacing javascript slide code to call images, phpcmsjavascript today found a js to be placed on phpcms! But his code is like this. Copy the code. The code is like...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn