This is a discussion on parse error within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hello, I am very new to PHP and have very limited knowledge but am learning. I have found a really ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello,
I am very new to PHP and have very limited knowledge but am learning. I have found a really great php script for image rotating links but am stuck as to how to make the links execute to a new window if needed to. The script has come from http://www.jab.poundingbeats.com/index.php?id=2 and yes I have mailed the man responsible for it with my question but without reply. The part I am coming unstuck with is adding a $sites[0] = array(http://www.site1.com target="_blank", "Text1", 5, "images/mybannerimage1.jpg"); $sites[1] = array("http://www.site2.com onclick="target='newwindow'"", "Text2", 1, "images/mybannerimage2.jpg"); $sites[2] = array("http://www.site3.com", "Text3", 5, "images/mybannerimage3.jpg"); $sites[3] = array("http://www.site1.com", "Text1", 1, "images/mybannerimage4.jpg"); Now I know that neither the target_blank or the onclick work because they won't parse, is there another way or am I missing something. If this is a ridiculous question then sorry but any help would be greatly appreciated. Andrew |
|
|||
|
@Homeonthecouch wrote:
> Hello, > > I am very new to PHP and have very limited knowledge but am learning. > > I have found a really great php script for image rotating links but am stuck > as to how to make the links execute to a new window if needed to. > > > > The script has come from http://www.jab.poundingbeats.com/index.php?id=2 and > yes I have mailed the man responsible for it with my question but without > reply. > > > > The part I am coming unstuck with is adding a > > Hi, I don't know that script, but the following code you have shown us contains errors, and is strange. > > $sites[0] = array(http://www.site1.com target="_blank", "Text1", 5, > "images/mybannerimage1.jpg"); That one could work. > $sites[1] = array("http://www.site2.com onclick="target='newwindow'"", > "Text2", 1, "images/mybannerimage2.jpg"); That one is bad. You use " as stringdelimiter for the first element, but the content of the string contains a " itself. If you want a literal " in a string delimitted by ", escape the character with \ So it should be at least: (mind the \ before the ") $sites[1] = array("http://www.site2.com onclick=\"target='newwindow'\"", "Text2", 1, "images/mybannerimage2.jpg"); And I also want to add that the onClick-eventhandler you made is strange. It says: onClick="target='newwindow'" That doesn't make a lot of sense. I think you want: target='newwindow' without the onClick. To sum it up: $sites[1] = array("http://www.site2.com target='newwindow'", "Text2", 1, "images/mybannerimage2.jpg"); That would probably apprear in the HTML as: <a href="http://www.site2.com" target='newwindow'><img src="images/mybannerimage2.jpg"></a> which makes more sense. Remember that I am guessing here. > $sites[2] = array("http://www.site3.com", "Text3", 5, > "images/mybannerimage3.jpg"); > $sites[3] = array("http://www.site1.com", "Text1", 1, > "images/mybannerimage4.jpg"); Both look good. > > > Now I know that neither the target_blank or the onclick work because they > won't parse, is there another way or am I missing something. > > > > If this is a ridiculous question then sorry but any help would be greatly > appreciated. Well, you'll have to learn basic HTML first, then check the source this script produces. It will be hard for you to produce anything on the web if you don't know HTML, javascript, and php, while you use them. :-) Tip1: Make sure you catch any errors by PHP by using error reporting. read more here: http://www.php.net Best of luck. Regards, Erwin Moller > > > > Andrew > > |
|
|||
|
I don't think I explained this very well.
I know the onclick and the target wont parse. I also know that when the relative data is pulled from the php into the HTML it wont validate because Target is not valid in "strict dtd" What I wanted, was to find a way to make some of the links load into the current browser window and some to load to a new browser window. The links I am using aren't relevant but they all load to the current browser webpage. $sites[0] = array("http://www.site4.com", "Text5", 2, "images/mybannerimage3.jpg"); $sites[1] = array("http://www.site2.com", "Text3", 5, "images/mybannerimage3.jpg"); $sites[2] = array("http://www.site3.com", "Text3", 5, "images/mybannerimage3.jpg"); $sites[3] = array("http://www.site1.com", "Text1", 1, "images/mybannerimage4.jpg"); Hope this explains it a little clearer? Andrew "Erwin Moller" <Since_humans_read_this_I_am_spammed_too_much@spam yourself.com> wrote in message news:475ac1f3$0$234$e4fe514c@news.xs4all.nl... > @Homeonthecouch wrote: >> Hello, >> >> I am very new to PHP and have very limited knowledge but am learning. >> >> I have found a really great php script for image rotating links but am >> stuck as to how to make the links execute to a new window if needed to. >> >> >> >> The script has come from http://www.jab.poundingbeats.com/index.php?id=2 >> and yes I have mailed the man responsible for it with my question but >> without reply. >> >> >> >> The part I am coming unstuck with is adding a >> >> > > Hi, > > I don't know that script, but the following code you have shown us > contains errors, and is strange. > >> >> $sites[0] = array(http://www.site1.com target="_blank", "Text1", 5, >> "images/mybannerimage1.jpg"); > > That one could work. > >> $sites[1] = array("http://www.site2.com onclick="target='newwindow'"", >> "Text2", 1, "images/mybannerimage2.jpg"); > > That one is bad. > You use " as stringdelimiter for the first element, but the content of the > string contains a " itself. > If you want a literal " in a string delimitted by ", escape the character > with \ > > So it should be at least: (mind the \ before the ") > > $sites[1] = array("http://www.site2.com onclick=\"target='newwindow'\"", > "Text2", 1, "images/mybannerimage2.jpg"); > > And I also want to add that the onClick-eventhandler you made is strange. > It says: onClick="target='newwindow'" > That doesn't make a lot of sense. > I think you want: > target='newwindow' without the onClick. > > To sum it up: > $sites[1] = array("http://www.site2.com target='newwindow'", > "Text2", 1, "images/mybannerimage2.jpg"); > > That would probably apprear in the HTML as: > <a href="http://www.site2.com" target='newwindow'><img > src="images/mybannerimage2.jpg"></a> > > which makes more sense. > > Remember that I am guessing here. > >> $sites[2] = array("http://www.site3.com", "Text3", 5, >> "images/mybannerimage3.jpg"); >> $sites[3] = array("http://www.site1.com", "Text1", 1, >> "images/mybannerimage4.jpg"); > > Both look good. > > >> >> >> Now I know that neither the target_blank or the onclick work because they >> won't parse, is there another way or am I missing something. >> >> >> >> If this is a ridiculous question then sorry but any help would be greatly >> appreciated. > > Well, you'll have to learn basic HTML first, then check the source this > script produces. > > It will be hard for you to produce anything on the web if you don't know > HTML, javascript, and php, while you use them. :-) > > Tip1: Make sure you catch any errors by PHP by using error reporting. > read more here: http://www.php.net > > Best of luck. > > Regards, > Erwin Moller > >> >> >> >> Andrew >> |
![]() |
| Thread Tools | |
| Display Modes | |
|
|