Guest saturnnights Posted March 22, 2006 Share Posted March 22, 2006 I have phpadsnew with Fantastico! so I've decided to give it a try... After creating the ad campaigns and configuring it, it generates code that I'm supposed to drop into my page: <?php if (@include(getenv('DOCUMENT_ROOT').'/phpadsnew/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('zone:1', 0, '', '', '0', $phpAds_context); echo $phpAds_raw['html']; } ?> Okay, I've put this into my index.tpl, at the bottom, after </div> and before </html> and nothing happens. I'm guessing here that the code (posted above) is missing something? What could it be? Tags of some sort? Many thanks! Mark Quote Link to comment Share on other sites More sharing options...
Guest groovejuice Posted March 22, 2006 Share Posted March 22, 2006 php code must be in a file with the extension .php for it to be parsed. I haven't tried this, but perhaps start looking at index.php in your store. Quote Link to comment Share on other sites More sharing options...
markscarts Posted March 22, 2006 Share Posted March 22, 2006 You can embed html in php files, and you can embed php in html files, but you can't embed php in.tpl files. I've seen others trying similar things, maybe with a search you can find some of those threads. Perhaps someone was able to fix it. As a last resort, you may be able to hire a programmer or coax one to help you over at cubecart.org forum. Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted March 22, 2006 Share Posted March 22, 2006 Okay, thanks for the info... I guess I should just wait to see if this is included in the next upgrade... This is the one feature of ZenCart that I miss (from when I was demoing it). Mind you, I hate the rest of ZenCart, but they had banner options galore... Thanks, Mark Quote Link to comment Share on other sites More sharing options...
convict Posted March 22, 2006 Share Posted March 22, 2006 You shouldnt wait on upgrade, only you need is parse YOUR $phpAds_raw['html'] to a template 'variable'. It could be a global index.tpl. You have to manage a good place - header content usually Example: <?php if (@include(getenv('DOCUMENT_ROOT').'/phpadsnew/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('zone:1', 0, '', '', '0', $phpAds_context); $body->assign("BANNER", $phpAds_raw['html']); } ?> Add code above just after $body = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/global/index.tpl"); in index.php (cart.php) Then you have to find right place in header area in your global template index.tpl, {cart.tpl) (skins/{your skin}/styleTemplates/global/index.tpl) for your {BANNER} template variable. Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted March 22, 2006 Share Posted March 22, 2006 Wow - I need to go have some dinner and then re-read that post! My blood sugar must be low Anyway, let me look it over and see if I can figure it out and then give it a try... Thanks, Mark Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted March 23, 2006 Share Posted March 23, 2006 You shouldnt wait on upgrade, only you need is parse YOUR $phpAds_raw['html'] to a template 'variable'. It could be a global index.tpl. You have to manage a good place - header content usually Example: <?php if (@include(getenv('DOCUMENT_ROOT').'/phpadsnew/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('zone:1', 0, '', '', '0', $phpAds_context); $body->assign("BANNER", $phpAds_raw['html']); } ?> Add code above just after $body = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/global/index.tpl"); in index.php (cart.php) Then you have to find right place in header area in your global template index.tpl, {cart.tpl) (skins/{your skin}/styleTemplates/global/index.tpl) for your {BANNER} template variable. Okay, so I should put the code above (that you modified from the original) after the piece of code you specified (in both index.php and cart.php). Then, insert {BANNER} into my /global/index.tpl and this will display my banner? Ideally, I'd like the banner to display at the bottom of the page. Would this be as simple as putting the {BANNER} at the bottom, next to the {SITE_DOCS} ? Sorry if I sound confused Thanks! Mark Quote Link to comment Share on other sites More sharing options...
markscarts Posted March 23, 2006 Share Posted March 23, 2006 Mark, once you get that tag {BANNER} working, you can put it just about anywhere on index.tpl Quote Link to comment Share on other sites More sharing options...
Guest willdashwood Posted March 23, 2006 Share Posted March 23, 2006 I've just tried doing that today too but I get: Fatal error: Call to a member function on a non-object in C:\apache2triad\htdocs\public_html\cubecart\index.php on line 91 Only just started playing around so will keep trying. Edit: My bad, forgot to place code AFTER $body = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/global/index.tpl"); hasn't displayed a banner but then I'm not sure I've set up phpAdsNew correctly yet. Quote Link to comment Share on other sites More sharing options...
Guest willdashwood Posted March 23, 2006 Share Posted March 23, 2006 Got it working but I've come to the conclusion that it's probably way beyond the requirements of my client and will take too long to get to grips with. Does anyone know of a basic banner management script that allows users to add their own banners rather than going through the admin each time? Quote Link to comment Share on other sites More sharing options...
convict Posted March 23, 2006 Share Posted March 23, 2006 EDIT: Late :w00t: Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted March 23, 2006 Share Posted March 23, 2006 Well, my first attempt said that there was an error in index.php right at the line where I'd inserted this I'm not sure if I'll be able to get this working, but I'll give it some more thought... Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted March 23, 2006 Share Posted March 23, 2006 D'oah! I got it - had to use another version of the automatically-generated code... Now I'm 95% done - just need to center it... What I have is a javascript version and not just a php one - I don't know exactly what I'm talking about, but on a whim, I started plugging things in and it just works! So, what is the code to format my banner? It's a script right before </body> I know it has "center" in it... :w00t: Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted March 23, 2006 Share Posted March 23, 2006 I know it has "center" in it... <align = "center"> :D Quote Link to comment Share on other sites More sharing options...
Guest willdashwood Posted March 24, 2006 Share Posted March 24, 2006 Or if you're creating a nice web standards compliant template use <style="margin: auto;">. Quote Link to comment Share on other sites More sharing options...
convict Posted March 24, 2006 Share Posted March 24, 2006 @saturnnights I see you solved banner issue. Welcome to the World of CubeCart modifications. :w00t: Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted March 24, 2006 Share Posted March 24, 2006 @saturnnights I see you solved banner issue. Welcome to the World of CubeCart modifications. Yes! Look out - next thing you know I'll be selling skins Not!! But I am learning a lot from you all - thanks for your help! Mark Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.