doumie7914 2017-01-18 22:14
浏览 42

如何向每个用户显示自定义数量的SVG圈子?

I am currently putting together a site that will host users. Each user will have a profile page that will display an array of SVG circles, with each user also having a corresponding SVG_number in there own row in the users table of the database.

So for example if User1 has an SVG_number of 20 stored in the database, then they will see 20 circles on their profile page.

My question concerns the addition of new users, and how to have the site differentiate between these users to display the right amount of circles after querying the SVG_number?

And will I have to pre-build all of these SVG elements, hide them somewhere, and have the right one displayed relative to the users SVG_number through some sort of IF statement?

Im not looking for specific code, just a general idea of how I would go about organising this?

Quite new to programming, so I'm not totally clear on what languages this would involve, or what process. any help or advice would be appreciated!

  • 写回答

1条回答 默认 最新

  • douqing5981 2017-01-18 22:21
    关注

    You should use the programming language available for your server. In most cases, this will be PHP.

    You need to make the .svg document end in .php, so you have a file like circles.php

    Then in the document you need:

    <?php
    header('Content-type: image/svg+xml');
    echo '<?xml version="1.0" standalone="no"?>';
    
    $number = ... (get this from the database. Search for PHP and MySQL)
    ?>
    <svg>
       ... your svg code ...
       <?php if ($number > 10) { ?>
         .. sample circle ...
       <?php } ?>
    </svg>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题