First you have to render the page, http://www.mmkb.com/weixiang/index/index.html
<divclass="main3 MT"> <H2class="W-title"> Case Show class="W-text"> offers a wide range of industry solutions to give you more options </p> <divclass="Container case"> <divclass="Row"> <foreachName="Alzs"item="Vo">//This side is traversing the output picture <divclass="col-lg-3 col-xs-12 casepic"> <divclass="Recent-work-wrap"> <a href="/weixiang/alzs/index?code= ' {$vo. a_id} '">//This is the key class="img-responsive"Src="__root__/uploads{$vo. Photo}"alt=""> <divclass="Overlay"> <divclass="Recent-work-inner"> foreach> </div> </div> <a href="Http://www.mmkb.com/weixiang/case/index" class=" More"> See more </a> </div>
Then you have to replace the path of these pictures, the idea is to each of the path to the Content page template add a code value (point to the Primary key), click the controller will traverse the output from the database
Controller
<?PHPnamespaceWeixiang\controller;use Think\controller;classIndexcontroller extends Controller { Publicfunction Index () {/** Traverse Header list*/$list= M ('article_cate'),where('pid=9')->order ('ID'),Select(); $ This->assign ('List', $list); /** Case Show//This is the display of the controller*/$alzs= M ('article'),where('cate_id=24'),Select(); $ This->assign ('Alzs', $alzs); /** News and information*/$XWZX=m ('article'),where('cate_id=21 and A_views=0'),Select(); $ This->assign ('XWZX', $XWZX); /** About micro-sharing*/$datu= M ('article'),where('cate_id=33'),Select(); $ This->assign ('Datu', $datu); /** Enjoy Advantage*/$youshi= M ('article'),where('cate_id=34'),Select(); $ This->assign ('Youshi', $youshi); $ This->display ('/public/index'); }}
The controller that points to the content page template
<?PHPnamespaceWeixiang\controller;use Think\controller;classAlzscontroller extends Controller { Publicfunction Index () {/** Traverse Header list*/$list= M ('article_cate'),where("pid=9")->order ('ID'),Select(); $ This->assign ('List', $list); /** Get content*/$code=$_get['Code']; Get the code value using the Get method $al= M ('article'),where("a_id = $code"),find (); Query the database based on the code value obtained, and pay attention to using the Find method to search for a data $ This->assign ('Al', $al); $ This->display ('/public/alzs'); Point to Alzs.html}}
Pointing to the alzs.html
<include file="Public/header"/><divclass="CASEBG"> <divclass="Container animated Bounceinup"> class="Newnav"> <divclass="Container"> <divclass="Row"> <divclass="col-lg-1 col-xs-3"><a href="" class=" Current"> All </a></div> <divclass="col-lg-1 col-xs-3"><a href=""> Micro official website </a></div> </div> </div></div><divclass="Detail Mt"> <divclass="Container"> <divclass="Row"> <divclass="col-lg-12 col-xs-12"> class="Row Mt"> <divclass="col-lg-1 col-xs-12"><a href=""> Prev </a></div> <divclass="col-lg-1 col-xs-12 col-lg-offset-10"><a href=""> Next </a></div> </div> </div></div><include file="Public/footer"/>
This can only be achieved by putting the data in the background interface.
thinkphp3.2 implementation Click on the image or text to enter the content page