where/filter records using URL string

28 posts by 3 authors in: Forums > CMS Builder
Last Post: August 17, 2010   (RSS)

By s2smedia - August 17, 2010

its being pulled onto the index page through a flash file which in pulling the data from an xml.php doc

Re: [s2smedia] where/filter records using URL string

By Jason - August 17, 2010

Hi,

Okay, I don't actually see that in the code, but you could try to add the query string to the xml.php file where you're calling it:

xml.php?createdByUserNum=NUM

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [s2smedia] where/filter records using URL string

By Jason - August 17, 2010

Hi,

You shouldn't need to hard code it. You can insert php directly into the html you're writing like this:

xml.php?club_name=CASL&createdByUserNum=<?php echo @$_REQUEST['createdByUserNum'];?>

This will take whatever number is in the url string and add it to the end of that url string.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By s2smedia - August 17, 2010

its a actionScript file calling the xml file...

can i rename it to be as.php?

Re: [s2smedia] where/filter records using URL string

By Jason - August 17, 2010

Hi,

If you could show me the code you're using and tell me what file that's inside, I can take a closer look.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By s2smedia - August 17, 2010

here is the AS file that the flash is using to load the xml.php file:



class Ticker {

private var news:Array = new Array(); //the array which stores objects containing text,date,time,link tags from each item in XML file
private var XMLFile:String="news.xml.php"; //the name of the XML file
private var currentMessage=-1; //the current possition in the news array (current displayed headline)
private var interval=-1; //inverval variable used in function rotateNews to change headlines
private var interval2=-1; //inverval variable used in function rotateNews to change headlines
private var textColor:Number; //text color from xml file
private var overColor:Number; //over state text color from xml file
private var arrowPress:Boolean=false;

public var maxCharCount:Number=-1; //max char count from XML file
public var newsTimer; //delay for each headline from XML files

static var instance:Ticker; //this class


//constructor
function Ticker() {
instance=this; //i am me :)
trace("- ticker started");
init(); //in the constructor function we don't have access to all stage members
}

//do intializations
function init(){
// align stage to top left corner
Stage.align = "TL";
// set scale mode to no scale
Stage.scaleMode = "noScale";
// create a listener object for the stage
var stageListener = new Object();
// this function will be triggered every time the window is resized
function rearrange() {
var w:Number = Stage.width, h:Number = Stage.height;
// rearange objects on stage
_root.news_text.txt.autoSize=true;
_root.news_back._width=w;
_root.news_back._y=h-_root.news_back._height;
_root.news_count._y=h-_root.news_count._height-12;
_root.news_count._x=w-_root.news_count._width-37;
_root.news_dateTime._y=h-_root.news_dateTime._height-4;
_root.news_dateTime._x=_root.a2._x;
_root.grad_right._x=w-_root.grad_right._width;
_root.grad_right._y=h-_root.grad_right._height-2;
_root.news_text._y=h-_root.news_text._height-3;
_root.grad_left._y=h-_root.grad_left._height-0.1;
_root.grad_up._x=_root.a1._x; _root.grad_up._y=h-26.2; _root.grad_up._width=w-_root.a1._width;
_root.news._x=_root.a1._x;
}
stageListener.onResize = rearrange;
// add stage listener
Stage.addListener(stageListener);
// arange objects on stage
rearrange();
//parse the XML file
XMLRead(XMLFile);
//assign event handler for text field
_root.news_text.onRollOver = instance.newsOnRollOver;
_root.news_text.onRollOut = _root.news_text.onReleaseOutside = instance.newsOnRollOut;
_root.news_text.onRelease = instance.newsOnRelease;
}

// this function reads the xml and saves the news to news array
function XMLRead(fileName) {
var xml:XML= new XML;
xml.ignoreWhite=true;
xml.onLoad = function (success:Boolean) {
//_root.news_text._y=301;
if (success) {
trace("-XML file: "+fileName+" successfully loaded.");
var mainNode:XMLNode=xml.firstChild.firstChild.firstChild;
//this will pars "main" node of the XML file
while (mainNode!=null) {
mainNode.nodeName.toLowerCase()=="maxcharcount"?instance.maxCharCount=Number(mainNode.firstChild.toString()):false;
mainNode.nodeName.toLowerCase()=="newstimer"?instance.newsTimer=Number(mainNode.firstChild.toString()):false;
mainNode.nodeName.toLowerCase()=="textcolor"?instance.textColor=Number(mainNode.firstChild.toString()):false;
mainNode.nodeName.toLowerCase()=="overcolor"?instance.overColor=Number(mainNode.firstChild.toString()):false;
mainNode=mainNode.nextSibling;
}
var itemsNode:XMLNode=xml.firstChild.firstChild.nextSibling.firstChild;
//this will pars "items" node of the XML file
while (itemsNode!=null) {
mainNode=itemsNode.firstChild;
var news_object:Object = new Object(); //creates an object
//this will pars "item" node of the XML file
while (mainNode!=null) {
mainNode.nodeName.toLowerCase()=="text"?news_object.text=mainNode.firstChild.toString():false;
mainNode.nodeName.toLowerCase()=="date"?news_object.date=mainNode.firstChild.toString():false;
mainNode.nodeName.toLowerCase()=="time"?news_object.time=mainNode.firstChild.toString():false;
mainNode.nodeName.toLowerCase()=="link"?news_object.link=mainNode.firstChild.toString():false;
mainNode.nodeName.toLowerCase()=="window"?news_object.window=mainNode.firstChild.toString():false;
mainNode=mainNode.nextSibling;
}
instance.news.push(news_object); //push the object into news array
itemsNode=itemsNode.nextSibling;
}

//set textColor to headline
var txt_fmt:TextFormat = new TextFormat();
txt_fmt.color = instance.textColor;
_root.news_text.txt.setTextFormat(txt_fmt);
//start to change news
instance.changeNews(true);
} else {
trace("Unable to load XML file: "+fileName);
}
}
//load xml file
xml.load(fileName);
}

//trim displayed text to macCharCount read from XML file
function trimToMaxCharCount(txt:String) : String {
if (txt.length>instance.maxCharCount) {
return txt.slice(0,instance.maxCharCount-3)+"...";
} else {
return txt;
}
}

//change news
function changeNews(ascending:Boolean) {
//clear all previus intervals that may be active to avoid overlap
clearInterval(instance.interval);
clearInterval(instance.interval2);
//adjust message counter
ascending?instance.currentMessage++:instance.currentMessage--;
if (instance.currentMessage<0) {
instance.currentMessage=instance.news.length-1;
}
if (instance.currentMessage>=instance.news.length) {
instance.currentMessage=0;
}
//wipe current headline <--- <--- ---> --->
//<MovieClip|Sound|TextField>.tween(property(ies), ending value(s) [, seconds, animation type, delay, callback, extra1, extra2]);
_root.news_dateTime.tween("_y",Stage.height,0.5);
_root.news_text.tween("_y",Stage.height-28-_root.news_text._height,1);
instance.interval2 = setInterval(function() {
clearInterval(instance.interval2);
//insert new headline
_root.news_dateTime.date.text=instance.news[instance.currentMessage].date;
_root.news_dateTime.time.text=instance.news[instance.currentMessage].time;
_root.news_text.txt.text=instance.trimToMaxCharCount(instance.news[instance.currentMessage].text);
//change format
var txt_fmt:TextFormat = new TextFormat();
txt_fmt.color = instance.textColor;
_root.news_text.txt.setTextFormat(txt_fmt);
//bring the headline back to its place ---> ---> <--- <---
_root.news_dateTime.tween("_y",Stage.height-_root.news_dateTime._height-4,0.5,"easeOutQuad");
_root.news_text.tween("_y",_root.news_text._y+25,0.5,"easeOutQuad");
//assign url and window to _root.news movie clip so we can find it easier
_root.news_text.url=instance.news[instance.currentMessage].link;
_root.news_text.window=instance.news[instance.currentMessage].window;
//display headline information <3/27>
_root.news_count.txt.text=(instance.currentMessage+1)+"/"+instance.news.length;
},500);
instance.interval=setInterval(instance.changeNews,instance.newsTimer*1000,true);
}

//news text events ------- STAT -------
function newsOnRollOver() {
clearInterval(instance.interval);
clearInterval(instance.interval2);
var txt_fmt:TextFormat = new TextFormat();
txt_fmt.color = instance.overColor;
_root.news_text.txt.setTextFormat(txt_fmt);
}

function newsOnRollOut() {
clearInterval(instance.interval2);
var txt_fmt:TextFormat = new TextFormat();
txt_fmt.color = instance.textColor;
_root.news_text.txt.setTextFormat(txt_fmt);
instance.interval2=setInterval(function(){clearInterval(instance.interval2);instance.changeNews(true);},1500);
}

function newsOnRelease() {
getURL(_root.news_text["url"],_root.news_text["window"]);
}
//news text events ------- STOP -------

}

Re: [s2smedia] where/filter records using URL string

By Chris - August 17, 2010

Hi s2smedia,

I'm afraid we can't offer support for ActionScript code.

I've done something similar before and it was non-trivial. You can find a few tutorials on how to pass information into ActionScript if you search Google for FlashVars. It's also possible to pass information in via the query string.

I hope this helps! Sorry we couldn't help more.
All the best,
Chris