Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bandal
Visitor

Re: setadurl question

newchannel,

Here is where I put my code in appPosterScreen.brs Later I will make it clickable to call the playadvideo routine.

Function showPosterScreen(screen As Object, category As Object) As Integer

if validateParam(screen, "roPosterScreen", "showPosterScreen") = false return -1
if validateParam(category, "roAssociativeArray", "showPosterScreen") = false return -1

m.curCategory = 0
m.curShow = 0
temp=getcategorylist(category)

' More Banner Ad settings
screen.SetAdUrl("http://www.xxx.com/roku/banner/sdbanner1.jpg","http://www.xxx.com/roku/banner/hdbanner1.jpg")
screen.SetListNames(getCategoryList(category))
screen.SetContentList(getShowsForCategoryItem(category, m.curCategory))
screen.SetAdDisplayMode("scale-to-fit")
screen.SetAdSelectable(false)
screen.Show()

' End Banner settings

if temp.count() > 1 then
0 Kudos
newchannel
Roku Guru

Re: setadurl question

Hi bandal,

Thanks for posting the code.

I added it on my posterscreen.brs, zipped and loaded to device. Not just on this try but on all tries with your code and my own code from before my channel dissappears from the device. Then when i go back to posterscreen.brs before changes and rezip, my channel shows back up.

Debug says syntax error but I can;t seem to find it. I'll see if I can post here what debugger shows in next reply.
http://www.victoryNOWfilmsandtv.com
0 Kudos
newchannel
Roku Guru

Re: setadurl question

Here is what debugger says:


*** ERROR compiling /pkg:/source/appPosterScreen.brs:
Syntax Error. (compile error &h02) in ...g:/source/appPosterScreen.brs(73)
Note: GC - Found 97 orphaned objects (objects in a circular ref loop).


What is &h02??
http://www.victoryNOWfilmsandtv.com
0 Kudos
RokuMarkn
Visitor

Re: setadurl question

That's just the code for the specific error that the compiler found and is usually not very interesting. The important thing is that it's saying you have a syntax error in line 73. What is your line 73?

--Mark
0 Kudos
newchannel
Roku Guru

Re: setadurl question

Hi RokuMartin,

Since that last debugger I did some other changes etc. But now it gives me more errors in more lines...lol. In line 44 I only have:

while true

But it says I have a syntax error. Can an extra space or return cause a syntax error?

Thank you.
http://www.victoryNOWfilmsandtv.com
0 Kudos
RokuJoel
Binge Watcher

Re: setadurl question

Not usually. in cases like this, check to see if there is a missing end while, or perhaps a missing end if, end sub, end function, something like that, missing up above or below the while true. If you have an opening statement without a closing statement, it throws everything off, so you need to track it down.

Most helpful thing is to keep backup copies of each edit you make, for example in JEdit, which I use, I have it keep a copy of the last 200 saves, so every time I save there is a copy of before and after.

- Joel
0 Kudos
newchannel
Roku Guru

Re: setadurl question

Hi Joel,

I downloaded jedit on your suggestion from before.

I discovered the post I left here was actually pertaining to another item I had in the debugger and was working on today. Regardless, I'll check that suggestion you made to see what I am missing.

The adurl, I left you a note just a moment ago. Can't figure out what the problem is with it. I made an image and its on the server. debugger was saying I had syntax errors in it. Checked many times but to no avail.

I'll have to keep trying. The display ads and the pre-roll video have to work and I'll keep tweaking till it comes together. The help you provide and people I have met in the forum are a big help.

Thank you.
http://www.victoryNOWfilmsandtv.com
0 Kudos
newchannel
Roku Guru

Re: setadurl question

Finally...I have the ad showing up on the posterscreen.

Now to figure out how to use a php script to randomly change the ad each time it loads and one major part will have been completed.

Any suggestions from anyone here on using php and where to place it? Is it a file that gets added to the server side?

Thank you.
http://www.victoryNOWfilmsandtv.com
0 Kudos
RokuJoel
Binge Watcher

Re: setadurl question

PHP is a file that you create on your server, and isn't too different from a regular web page, in fact you can mix php in with html:

<html>
<title>this is my web page</title>
<body>
this is the body of my web page<br>
<?

echo 'this is the php section';

?>
<br>
this is more of the body of my web page
</body>
</html>


or you can just create a php file like my.php and have the contents like this:

<?

echo 'this is my php page';

?>


so if you were going to install an ad serving php program on your web server, you would probably just create a folder and upload the program files into that folder, then you would just point SetAdURL at the ad serving file like:

screen.setadurl("http://myserver.com/adverts/myad.php","http://myserver.com/adverts/myad.php")

and it your ad server would automatically choose the ad graphics to display. It might need to be modified a bit so it just serves the graphics and nothing more.

Usually this would integrate with a database on your server so you would need to give the script the username and password to your database when you set it up.

Some ad rotation php scripts don't need a database, you just dump the ad images into a folder with the script.

- Joel
0 Kudos
newchannel
Roku Guru

Re: setadurl question

I located several php ad rotation scripts. I'm going with one without database for now. I do plan for it to be more extensive later so I can have statistics on the ad views.

I'll give it a try.

Thank you.
http://www.victoryNOWfilmsandtv.com
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.