search
Homephp教程php手册解决phpcms更换javascript的幻灯片代码调用图片问题

这篇文章主要介绍了解决phpcms更换javascript的幻灯片代码调用图片问题,需要的朋友可以参考下

今天找到了一个js要放在phpcms上边!但是他的代码是这样的

复制代码 代码如下:


var titles = '创顶1|创顶2|创顶3|创顶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/|';

只能识别这种,,今天我们就解决这样的问题,下边就是我的思想和代码

复制代码 代码如下:


var title = new 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解决phpcms更换javascript的幻灯片代码调用图片问题 if(files=="") files = img[i];  //如果files=空 就赋值files == img[1] 然后+| +img[2] 最后就会输出上边的格式
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;  //赋值
var imgs= files;
var urls=links;

这个其实很简单,主要就是思维上边的问题。

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software