kenhar Posted June 28, 2014 Share Posted June 28, 2014 How to check cubecart 5 in admin login or not. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 28, 2014 Share Posted June 28, 2014 Welcome kenhar! Glad to see you made it to the forums. I don't understand your situation. Quote Link to comment Share on other sites More sharing options...
kenhar Posted June 30, 2014 Author Share Posted June 30, 2014 i am use cubecart 5.2.12 and run one link if user is admin other wise this link not run. how to check user login or not. please help me. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 30, 2014 Share Posted June 30, 2014 Ok. Depending where the link is going to appear, you can try this:{if $IS_USER}<a href="link">Link</a>{else}Not a Link{/if} The template variable is available in the template file main.php. I do not know if it is available in any of the other templates. This is why it matters: CubeCart builds the "content" area in the first phase (Homepage, Product, Category, Document). Then builds all the extra parts in the second phase (Login, Navigation, Shopping Basket, Featured Product, etc). Then builds the main page in the third phase and puts those parts into it. So, a variable that is assigned in the first phase is available in the other two phases, but not the other way. Looking through the code, it seems that $IS_USER is given a value and assigned to a template variable very much near the beginning of CubeCart "waking up". So, you should be able to use it everywhere. Quote Link to comment Share on other sites More sharing options...
kenhar Posted June 30, 2014 Author Share Posted June 30, 2014 thanks reply But how to use this code other file or new created file. i am create new file like hello.php if user is login after run this file display file inner content other wise not display. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 30, 2014 Share Posted June 30, 2014 In CubeCart, it is difficult to have PHP code and HTML output in the same file. So, to make sure I understand what you want, I will rename your file to hello.html. Try:{if $IS_USER}{include 'main.html'}{/if} 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.