StroiX Posted June 16, 2009 Share Posted June 16, 2009 Please help if possible. The following code as of now produces the text on three separate lines, like this: My Account Edit Account Logout However, I would like to display in the following manner instead: My Account Edit Account Logout I would like to link the page to a style sheet and insert a div tag which will also have some other value such as color and etc.. of the hyperlinks. I guess my question is then: How is it possible to insert a div tag and <ul> tag the PHP code below so that I have an unordered list which I could later modify in CSS? Please provide a working example if possible, thank you. <?php /** * User has already logged in, so display relavent links, including * a link to the admin center if the user is an administrator. */ if($session->logged_in){ echo "<a href=\"userinfo.php?user=$session->username\">My Account</a>" ."<a href=\"useredit.php\">Edit Account</a>"; if($session->isAdmin()){ echo "<a href=\"admin/admin.php\">Admin Center</a>"; } echo "<a href=\"process.php\">Logout</a>"; } else{ ?> Link to comment https://forums.phpfreaks.com/topic/162335-solved-insert-htmlcss-in-php/ Share on other sites More sharing options...
xcoderx Posted June 16, 2009 Share Posted June 16, 2009 Quote Please help if possible. The following code as of now produces the text on three separate lines, like this: My Account Edit Account Logout However, I would like to display in the following manner instead: My Account Edit Account Logout I would like to link the page to a style sheet and insert a div tag which will also have some other value such as color and etc.. of the hyperlinks. I guess my question is then: How is it possible to insert a div tag and <ul> tag the PHP code below so that I have an unordered list which I could later modify in CSS? Please provide a working example if possible, thank you. <?php /** * User has already logged in, so display relavent links, including * a link to the admin center if the user is an administrator. */ if($session->logged_in){ echo "<a href=\"userinfo.php?user=$session->username\">My Account</a>" ."<a href=\"useredit.php\">Edit Account</a>"; if($session->isAdmin()){ echo "<a href=\"admin/admin.php\">Admin Center</a>"; } echo "<a href=\"process.php\">Logout</a>"; } else{ ?> Link to comment https://forums.phpfreaks.com/topic/162335-solved-insert-htmlcss-in-php/#findComment-856851 Share on other sites More sharing options...
xcoderx Posted June 16, 2009 Share Posted June 16, 2009 <?php /** * User has already logged in, so display relavent links, including * a link to the admin center if the user is an administrator. */ if($session->logged_in){ echo "<div class="/whatere u got"/>"; echo "<ul><a href=\"userinfo.php?user=$session->username\">My Account</a></ul>" ."<ul><a href=\"useredit.php\">Edit Account</a></ul>"; if($session->isAdmin()){ echo "<ul><a href=\"admin/admin.php\">Admin Center</a></ul>"; } echo "<ul><a href=\"process.php\">Logout</a></ul>"; echo "</div>"; } else{ ?> hope this helps? Link to comment https://forums.phpfreaks.com/topic/162335-solved-insert-htmlcss-in-php/#findComment-856856 Share on other sites More sharing options...
StroiX Posted June 16, 2009 Author Share Posted June 16, 2009 Thank for your reply. I tried what you posted and I am getting the following error now, any suggestions? Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /vservers/ssagarco/htdocs/login/index.php on line 37 Thank you. Link to comment https://forums.phpfreaks.com/topic/162335-solved-insert-htmlcss-in-php/#findComment-856876 Share on other sites More sharing options...
xcoderx Posted June 16, 2009 Share Posted June 16, 2009 <?php /** * User has already logged in, so display relavent links, including * a link to the admin center if the user is an administrator. */ if($session->logged_in){ echo "<div class=\"whatere u got\">"; echo "<ul><a href=\"userinfo.php?user=$session->username\">My Account</a></ul>" ."<ul><a href=\"useredit.php\">Edit Account</a></ul>"; if($session->isAdmin()){ echo "<ul><a href=\"admin/admin.php\">Admin Center</a></ul>"; } echo "<ul><a href=\"process.php\">Logout</a></ul>"; echo "</div>"; } else{ ?> sorry try this Link to comment https://forums.phpfreaks.com/topic/162335-solved-insert-htmlcss-in-php/#findComment-856880 Share on other sites More sharing options...
StroiX Posted June 16, 2009 Author Share Posted June 16, 2009 Still same problem, here is the error again: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /vservers/ssagarco/htdocs/login/index.php on line 37 And line 37 is: echo "<div class=\"login-quickmenu\">"; Please let me know if you would like me to try something else instead and thank you once again! Link to comment https://forums.phpfreaks.com/topic/162335-solved-insert-htmlcss-in-php/#findComment-856935 Share on other sites More sharing options...
xcoderx Posted June 16, 2009 Share Posted June 16, 2009 Do u at al know php? <?php /** * User has already logged in, so display relavent links, including * a link to the admin center if the user is an administrator. */ if($session->logged_in){ echo "<div class=\"login-quickmenu\">"; echo "<ul><a href=\"userinfo.php?user=$session->username\">My Account</a></ul>"; echo "<ul><a href=\"useredit.php\">Edit Account</a></ul>"; if($session->isAdmin()){ echo "<ul><a href=\"admin/admin.php\">Admin Center</a></ul>"; } echo "<ul><a href=\"process.php\">Logout</a></ul>"; echo "</div>"; } else{ ?> it wont give error again. Link to comment https://forums.phpfreaks.com/topic/162335-solved-insert-htmlcss-in-php/#findComment-856938 Share on other sites More sharing options...
StroiX Posted June 16, 2009 Author Share Posted June 16, 2009 Thanks the "echo" in front of it worked. I did very little PHP about 5 years ago and it has clearly been forgotten. Thanks once again for your help with this. Link to comment https://forums.phpfreaks.com/topic/162335-solved-insert-htmlcss-in-php/#findComment-856961 Share on other sites More sharing options...
xcoderx Posted June 16, 2009 Share Posted June 16, 2009 Glad to help :-) Link to comment https://forums.phpfreaks.com/topic/162335-solved-insert-htmlcss-in-php/#findComment-856974 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.