Fix phpcms change javascript slide code call picture Problem _php instance

Source: Internet
Author: User
Today found a JS to put on the top of PHPCMS! But his code is like this.

Copy the Code code as follows:
var titles = ' Create top 1| top 2| Create top 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/|http://baby220818.gotoip2.com/|http:// baby220818.gotoip2.com/';

Can only recognize this, today we solve this problem, below is my thought and code

Copy the Code code as follows:
var title = new Array (); First, declare that the array is loaded 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;iif (files== ") files = Img[i];//If files= null is assigned files = = Img[1] Then +| +img[2] The top format will be output at the end.
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; Assign value
var imgs= files;
var urls=links;

This is actually very simple, mainly is the problem of thinking above.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.