dongshao8125 2015-02-01 17:05
浏览 36

如何使用PHP和Yii2构建搜索页面?

I need to build a search page with PHP (preferably using Yii2 framework) similar to this one.

Let me explain this further. There are 6 levels of "CPV codes". Users will see the first level as links all the time, and there are 45 of them. When user click on some first level CPV code, for example CPV 24000000 - Chemical products, they will see 7 new links, CPV codes of second level.

At that moment I want to give users 2 buttons next to each link from second level cpv code, one for up, second for down, meaning that if they click up, they will see CPV code that is one level higher, in this case they will be back to 24000000, or if they click on some CPV of second level (down) they will see CPV codes of third level, but related to the one they chose from second.

So if first level is 24000000, once they click on it they will see 7 CPV codes of second level like this:

 24100000 : Gases  
 24200000 : Dyes and pigments  
 24300000 : Basic inorganic and organic chemicals  
 24400000 : Fertilisers and nitrogen compounds  
 24500000 : Plastics in primary forms  
 24600000 : Explosives  
 24900000 : Fine and various chemical products  

At this moment, next to each of these links there will be 2 options, up and down. If they click UP next to 24100000 Gases, they will see 24000000 Chemical products, if they click DOWN, they will see 24110000 : Industrial gases

If I am storing CPV codes in mysql database table called CPV, and I have 2 columns id = CPV code, and name = CPV name, how can I build this? I have no clue. I know that there is strict hierarchy, but do not know exactly how to use it.

Note: when I pull CPV codes from database, I would like to get it as an array of objects (like Yii2 findAll() AR method).

Can anyone help me with this?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分