Discuz!NT 2.5 正式版 下载
beta、RC版升级补丁
中秋模板发布
首届Discuz!NT 模板大赛圆满结束
著名音乐网站SoGua网、分贝网
采用Discuz!NT搭建社区
FIFA Online2官网论坛使用Discuz!NT
游戏城寨论坛使用Discuz!NT搭建
Discuz!NT 2.5正式开源 Discuz!NT文档中心
用户整合说明文档
Discuz!NT亮相微软Tech-Ed 2007
Discuz!NT情景搞笑短片抢先看
武林三国《赤壁》下(双线二区)开服好礼大放送
1/1页1 跳转到查看:1117
发新话题 回复该主题

投票整合-FLASH调用- V1.0 教程..实用 极品 附源码

投票整合-FLASH调用- V1.0 教程..实用 极品 附源码

投票整合-FLASH调用- V1.0 教程..实用 极品


投票整合-FLASH调用- V1.0
教程..实用  极品 2.0RC net1.1/2.X/3.X For Mssql+ access
演示网址:http://www.axnsx.cn/bbs
本插件支持只支持  Discuz!NT 2.0RC
net Framework 1.1
版本
.net Framework 2.x/3.x版本
支持Mssql , access 数据库.
功能: 调用论坛中最新的前3个投票,随机显示,
贴子调用,是最新发表的,最多人回复的(最近30天),最多人看的(最近30天),最新精华贴 的前20个。
自定背景式样
安装:
poll整个目录放到论坛的目录内

bin目录上的文件复制到网站的bin目录内.

然后,就可以在论坛首页
forumindex.htm
里添加
下面代码..
  从这里开始加入
<!--bbs-list area start-->
<script language="javascript" src="poll/js/flash.js"></script>
<DIV style="CLEAR: both; HEIGHT: 202px; width: 900px;">
<!-投票插件-三格FLASH调用-->

<div style="float:left; width:300px; height: 200px;" id=poll1></div>
<div style="float:left; width:300px; height: 200px;" id=topShow></div>
<div style="float:left; width:300px; height: 200px;" id=topShow2></div>

<script language="javascript">
insertFlash("poll1","poll/poll.swf", 300, 200);
insertFlash("topShow","poll/topShow.swf", 300, 200);
insertFlash("topShow2","poll/topShow.swf", 300, 200);<!—这个跟上一个调用相同-->
</script>
</DIV>
然后生成该页..OK!!
^_^

当然如果是按照默的宽度,..页面生成来出是有偏位的..
推荐将页面统一改为900px
这样空出来比较好看一点

怎么设置呢?
好简单.
  只要在dnt.css 文件中..
#container{ width: 98%; margin: 0 auto; backgroundFFF; min-width: 778px;}改成
#container{ width: 900px; margin: 0 auto; backgroundFFF; min-width: 778px;}

OK..


欢迎交流


神童阿杜

QQ:2663666



11月8日
增加了
net Framework 1.1版本






2008-11-20
更新..
新增了,式样的自定义…..
投票的pollBlack.fla 背景式样可以在flash打开,换上自己论坛上的颜色..
帖子调用 topShowBlack.fla背景式样可以在flash打开,换上自己论坛上的颜色..

还有对应的文字连接式样文字
投票的pollStyles.css
文件打开可以自行设置超链接的式样.
帖子调用topShowStyles.css
文件打开可以自行设置超链接的式样.





分部代码:
////////  poll.aspx.cs 文件

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Data.OleDb;
using Discuz.Forum;
using Discuz.Data;
using Discuz.Common;
using Discuz.Cache;
using Discuz.Config;
using Discuz.Control;
using Discuz.Entity;
using Discuz.ForumPage;
using Discuz.Install;
using Discuz.PlugIn;
using Discuz.Space;
using Discuz.Web;
using Discuz.WebService;

public partial class poll_poll : System.Web.UI.Page
    {
        public int pagesizeN = 8; //默认每页显示条数
        private string Tableprefix = BaseConfigs.GetTablePrefix;
        public static string pstrdir = BaseConfigs.GetForumPath;
        public static string strDbtype = BaseConfigs.GetDbType;
        public string strurl = HttpContext.Current.Request.Url.Authority.ToString() + pstrdir;
        public string pstrurl = HttpContext.Current.Request.Url.Authority.ToString() + pstrdir + "showtopic-";
       
        //public static GeneralConfigInfo cc = new GeneralConfigInfo(); //初始化论坛基础类
             
        //public string exName = cc.Extname;  //扩展名
        public string exName = ConfigFactory.Deserialize(Utils.GetMapPath(BaseConfigFactory.GetForumPath + "config/general.config")).Extname;
       
           

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (strDbtype == "Access")
                {
                    DBinderAccess();
                }
                if (strDbtype == "SqlServer")
                {
                    DBinderSqlServer();
                }
            }
        }
最后编辑macowin 最后编辑于 2007-11-26 14:09:01

TOP

 

回复: 投票整合-FLASH调用- V1.0 教程..实用 极品

private void DBinderSqlServer()
        {
            try
            {
                string str = "select * from " + Tableprefix + "topics where poll = 1";
                string conStr = BaseConfigFactory.GetDBConnectString;
                SqlConnection con = new SqlConnection(conStr);
                con.Open();
                SqlDataAdapter sda1 = new SqlDataAdapter();
                sda1.SelectCommand = new SqlCommand(str, con);
                DataSet ds = new DataSet();
                sda1.Fill(ds);
                sda1.Dispose();
                //分页控件实例化(必须实例化一次) 
                System.Web.UI.WebControls.PagedDataSource pds = new PagedDataSource();
                //附加数据 
                pds.DataSource = ds.Tables[0].DefaultView;
                //允许分页 
                pds.AllowPaging = true;
                //设置每页数据个数 
                pds.PageSize = pagesizeN;
                int allpage = pds.PageCount;
                //这个判断语句的作用是对cpage进行赋值   
                int cpage;
                if (Request.QueryString["Page"] != null)
                {
                    cpage = Convert.ToInt32(Request.QueryString["Page"]);
                }
                else
                {
                    cpage = 1;
                }
                //pds对象的当前引索值,因为引索值是从0开始,cpage从1开始所以要减1   
                pds.CurrentPageIndex = cpage - 1;
                //Request.CurrentExecutionFilePath为当前的程序的文件名,也可以直接写 
                if (!pds.IsFirstPage)
                {
                    HyperLink1.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToInt32(cpage - 1);
                }
                if (!pds.IsLastPage)
                {
                    HyperLink2.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToInt32(cpage + 1);
                }
                //获取页码 
                Label1.Text = "第" + cpage.ToString() + "页";
                Label2.Text = "共" + allpage.ToString() + "页";
                DataList1.DataSource = pds;
                DataList1.DataBind();
            }
            catch (Exception e)
            {
                Response.Write("输入的参来有误!");
            }
        }
      private void DBinderAccess()
        {
        try
        {
            string str = "select * from " + Tableprefix + "topics where poll = 1";
            string conStr = BaseConfigFactory.GetDBConnectString;
            OleDbConnection con = new OleDbConnection(conStr);
            con.Open();
            OleDbDataAdapter sda1 = new OleDbDataAdapter();
            sda1.SelectCommand = new OleDbCommand(str, con);
            DataSet ds = new DataSet();
            sda1.Fill(ds);
            sda1.Dispose();
            //分页控件实例化(必须实例化一次) 
            System.Web.UI.WebControls.PagedDataSource pds = new PagedDataSource();
            //附加数据 
            pds.DataSource = ds.Tables[0].DefaultView;
            //允许分页 
            pds.AllowPaging = true;
            //设置每页数据个数 
            pds.PageSize = pagesizeN;
            int allpage = pds.PageCount;
            //这个判断语句的作用是对cpage进行赋值   
            int cpage;
            if (Request.QueryString["Page"] != null)
            {
                cpage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                cpage = 1;
            }
            //pds对象的当前引索值,因为引索值是从0开始,cpage从1开始所以要减1   
            pds.CurrentPageIndex = cpage - 1;
            //Request.CurrentExecutionFilePath为当前的程序的文件名,也可以直接写 
            if (!pds.IsFirstPage)
            {
                HyperLink1.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToInt32(cpage - 1);
            }
            if (!pds.IsLastPage)
            {
                HyperLink2.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToInt32(cpage + 1);
            }
            //获取页码 
            Label1.Text = "第" + cpage.ToString() + "页";
            Label2.Text = "共" + allpage.ToString() + "页";
            DataList1.DataSource = pds;
            DataList1.DataBind();
        }
        catch (Exception e)
        {
            Response.Write("输入的参来有误!");
        }
    }
    }

TOP

 

回复: 投票整合-FLASH调用- V1.0 教程..实用 极品

///////  poll.aspx  文件
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="poll.aspx.cs" Inherits="poll_poll" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>AXNSX.CN 投票列表</title>
    <link media=all href="http://<%= strurl %>templates/default/dnt.css" type=text/css rel="stylesheet">
   
    <script src="http://<%= strurl %>templates/default/report.js" type="text/javascript"></script>
<script src="http://<%= strurl %>templates/default/images/common.js" type="text/javascript"></script>
<script src="http://<%= strurl %>templates/default/menu.js" type="text/javascript"></script>
</head>
<body>
  <form id="form1" runat="server">
    <center>
    <div>
        <aspanel ID="Panel3" runat="server" Height="50px" Width="910px">
<div id="container"><!--header start-->
<div id="NtForumHead">
<div class="NtForumHeadLeft">
<ul>
  <li style="PADDING-RIGHT: 12px">
  <h2><a title="by AXNSX.CN"
  href="http://<%= strurl %>forumindex.aspx"><img alt="logo"
  src="http://<%= strurl %>templates/default/images/clogo.gif"/></a><span>By AXNSX.CN</span> </h2></li>
  <li class="MarTop"><a href="http://<%= strurl %>forumindex.aspx"><img
  src="http://<%= strurl %>templates/default/images/Headforum.gif"/></a>
  <h3><a href="http://<%= strurl %>forumindex.aspx">论坛</a></h3></li>
  <li class="MarTop"><img src="http://<%= strurl %>templates/default/images/headline.jpg"/> </li>
  <li class="MarTop"><a href="http://<%= strurl %>spaceindex.aspx"><img
  src="http://<%= strurl %>templates/default/images/headspace.gif"/></a>
  <h3><a href="http://<%= strurl %>spaceindex.aspx">Blog</a></h3></li>
  <li class="MarTop"><img src="http://<%= strurl %>templates/default/images/headline.jpg"/> </li>
  <li class="MarTop"><a href="http://<%= strurl %>albumindex.aspx"><img
  src="http://<%= strurl %>templates/default/images/headphoto.gif"/></a>
  <h3><a
href="http://<%= strurl %>albumindex.aspx">相册</a></h3></li></ul></div>
<P><a
class="reg" href="http://<%= strurl %>usercp.aspx">用户中心</a> <a class="reg"
href="http://<%= strurl %>admin/index.aspx" target="_blank">系统设置</a> <a
href="http://<%= strurl %>forumindex.aspx">论坛</a> <a
href="http://<%= strurl %>spaceindex.aspx">Blog</a> <a
href="http://<%= strurl %>albumindex.aspx">相册</a> </P>
<div id="ad"><EMBED src="http://<%= strurl %>adbanner/topadd/GOGOGZ.swf"
width="480" height="60" type="application/x-shockwave-flash"
wmode="opaque"></EMBED></div></div>
</div>
      </aspanel>
     
        <aspanel ID="Panel1" runat="server" Height="400px" Width="910px" class="container">
            <aspataList ID="DataList1" runat="server" CellPadding="4" ForeColor="#333333">
                <ItemTemplate>
              <table>
              <tr>
              <td>
                主题: <a href="http://<%# pstrurl%><%# DataBinder.Eval(Container.DataItem, "tid")%><%# exName %>" target= "_self"> <%# DataBinder.Eval(Container.DataItem, "title")%> </a>
              </td>
              </tr>
              <tr>
              <td>
              发贴人: <%# DataBinder.Eval(Container.DataItem, "poster")%>      发布时间:<%# DataBinder.Eval(Container.DataItem, "postdatetime", "{0:yy-MM-dd}")%>        最后回复时间:<%# DataBinder.Eval(Container.DataItem, "lastpost", "{0:yy-MM-dd}")%>        查看数:<%# DataBinder.Eval(Container.DataItem, "views")%>        回复数:<%# DataBinder.Eval(Container.DataItem, "replies")%>
              </td>
              </tr>
             
              </table>
                 
                </ItemTemplate>
                <AlternatingItemTemplate>
              <table>
              <tr>
              <td>
                主题: <a href="http://<%# pstrurl%><%# DataBinder.Eval(Container.DataItem, "tid")%><%# exName %>" target= "_self"> <%# DataBinder.Eval(Container.DataItem, "title")%> </a>
              </td>
              </tr>
              <tr>
              <td>
              发贴人: <%# DataBinder.Eval(Container.DataItem, "poster")%>      发布时间:<%# DataBinder.Eval(Container.DataItem, "postdatetime", "{0:yy-MM-dd}")%>        最后回复时间:<%# DataBinder.Eval(Container.DataItem, "lastpost", "{0:yy-MM-dd}")%>        查看数:<%# DataBinder.Eval(Container.DataItem, "views")%>        回复数:<%# DataBinder.Eval(Container.DataItem, "replies")%>
              </td>
              </tr>
             
              </table>
              </AlternatingItemTemplate>
                <AlternatingItemStyle BackColor="White" ForeColor="#284775" />
                <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" Horiz Width="910px" Font-Size="9pt" />
                <SeparatorTemplate>
                    <hr />
                </SeparatorTemplate>
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderTemplate>
                    <strong>AXNSX.CN 投票列表</strong>
                </HeaderTemplate>
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Horiz Font-Size="14pt" />
            </aspataList> 
        </aspanel>
                <aspanel ID="Panel2" runat="server" Height="50px" Width="910px">
        <aspabel ID="Label1" runat="server" Width="140px"></aspabel>
        <asp:HyperLink ID="HyperLink1" runat="server" Width="78px">上一页</asp:HyperLink>
        <asp:HyperLink ID="HyperLink2" runat="server" Width="86px">下一页</asp:HyperLink>
            <aspabel ID="Label2" runat="server" Width="136px"></aspabel></asp:Panel>
        <asp:Panel ID="Panel4" runat="server" Height="50px" Width="910px">
重要声明:本讨论区是以即时上载留言的方式运作,AXNSX.CN对所有留言的真实性、完整性及立场等,不负任何
      法律责任。而一切留言之言论只代表留言者个人意见,并非本网站之立场,用户不应信赖内容,并应自行判断内容之真实性。于有关情形下,用户应寻求专业意见
      (如涉及医疗、法律或投资等问题)。
      由于本讨论区受到「即时上载留言」运作方式所规限,故不能完全监察所有留言,若读者发现有留言出现问题,请联络我们。AXNSX.CN有权删除任何留言及拒绝任何人士上载留言,同时亦有不删除留言的权利。切勿撰写粗言秽语、诽谤、渲染色情暴力或人身攻击的言论,敬请自律。本网站保留一切法律权利。
            </asp:Panel>
             
    </div>
       
        </center>
    </form>
</body>
</html>

TOP

 

回复:投票整合-FLASH调用- V1.0 教程..实用 极品 附源码

TOP

 

回复:投票整合-FLASH调用- V1.0 教程..实用 极品 附源码

。。。。。。。
常见问题请先参看各版块置顶贴, 或参阅文档中心相关内容:  点击查看
提问问题请尽量在标题中说明大概
欢迎提意见建议
为了不耽误您的问题尽快解决,请勿发送短消息

TOP

 
1/1页1 跳转到
发表新主题 回复该主题