The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Coding a PHP menu

View previous topic View next topic Go down

Coding a PHP menu

Post by SyndromeLA on Tue Jun 11, 2013 12:21 am

Ive been working on structuring my forumotion forum to match my Wordpress site. However im getting hung up at the menu. I can turn it into HTML but it does not function like it should.

So my question:
Is it possible to take a PHP menu off a wordpress site and make it functional on forumotion? Dropdown included.

My Wordpress menu looks as follows in CODE:

Code:
<select id = "responsive-main-nav-menu" onchange = "javascript:window.location.replace(this.value);"><option selected="selected" ><?php _e('Menu', 'site5framework'); ?></option></select>
                     
                     <nav id="main-navigation" class="main-menu">
                     <?php
                     site5_main_nav( array(
                      'container' =>false,
                      'menu_class' => '',
                      'echo' => true,
                      'before' => '',
                      'after' => '',
                      'link_before' => '',
                      'link_after' => '',
                      'depth' => 0
                      )
                      );
                      // Adjust using Menus in Wordpress Admin ?>
                     </nav>

Is there a PHP file I can reference? Im not that great with PHP or anything. Basic HTML and CSS.
avatar
SyndromeLA
New Member

Posts : 21
Reputation : 0
Language : English

Back to top Go down

Re: Coding a PHP menu

Post by Richard. on Tue Jun 11, 2013 12:27 am

your code doesnt work, could you give us a da site of wordpress where i can see the menu you want?
avatar
Richard.
Forumember

Male Posts : 249
Reputation : 12
Language : English,Romanian
Location : Durham, NC - USA.

http://forum.phpbbonline.com/

Back to top Go down

Re: Coding a PHP menu

Post by SyndromeLA on Tue Jun 11, 2013 12:42 am

http://gamesleepcreate.com/

Im trying to make the top menu work.

avatar
SyndromeLA
New Member

Posts : 21
Reputation : 0
Language : English

Back to top Go down

Re: Coding a PHP menu

Post by kirk on Tue Jun 11, 2013 1:11 am

what is your site?
this is not a forumotion forum
http://gamesleepcreate.com/forum/

and where are you getting the coding from. there may be a way to import it from a html page, but cant be sure without having all the details to the scripts you are using and url to your forum.
avatar
kirk
Forumaster

Male Posts : 11037
Reputation : 651
Language : English,Vulcan,Klingon, Romulan,& Gorn

Back to top Go down

Re: Coding a PHP menu

Post by SyndromeLA on Tue Jun 11, 2013 1:56 am

URL to forums is:

http://forums.gamesleepcreate.com/

The forums you posted about is simply a Wordpress plugin. I much prefer Forumotion.

Its a big mess in the coding department. As its still heavily under construction.
avatar
SyndromeLA
New Member

Posts : 21
Reputation : 0
Language : English

Back to top Go down

Re: Coding a PHP menu

Post by Ultron's Vision on Tue Jun 11, 2013 8:24 am

PHP isn't supported by forumotion, sadly (besides from the native PHP support all forums use), means you cannot embed PHP scripts in forumotion.
avatar
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Re: Coding a PHP menu

Post by kirk on Tue Jun 11, 2013 11:09 am

right the only thing i can think of is to use something that supports php for pages like dose anything from word press give you pages you can work with?, then import them using iframes or what not. unless there is some kind of php script host you can upload php files to like some of the java scripts host. but not sure if thats even possible or if they exist?

i think your best bet world be to seach for what your trying to do for java scripts.
avatar
kirk
Forumaster

Male Posts : 11037
Reputation : 651
Language : English,Vulcan,Klingon, Romulan,& Gorn

Back to top Go down

Re: Coding a PHP menu

Post by Ultron's Vision on Tue Jun 11, 2013 11:27 am

There are plenty of free webhosts that support PHP scripts and you can indeed import them via iframes, if that is what you need @OP
avatar
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Re: Coding a PHP menu

Post by SyndromeLA on Tue Jun 11, 2013 6:34 pm

I was digging through all of the PHP files and cannot for the life of me figure out which one has the script in it for this menu to work. Otherwise I would of referenced it same as Java. It has to be there, or else it wouldnt work on the original site. Im thinking it is something built natively into wordpress that is being used. I'll dig some more.

If all else fails iframes would be my last resort. Always heard bad things about those. Like how easy they are to hack. :/

Edit: Although if php doesnt work in general I suppose thats a waste of time haha. I may just re-code the entire thing in CSS and HTML to match.

I dont know.

Edit #2: Whats the drawback to using an iframe? I know they are frowned upon in the coding community in general, but that may be my best option. Ive already started the process of implementing my forums onto a page of my website via iframes.
avatar
SyndromeLA
New Member

Posts : 21
Reputation : 0
Language : English

Back to top Go down

Re: Coding a PHP menu

Post by Ultron's Vision on Tue Jun 11, 2013 10:49 pm

IFrames' src attributes are definitely too easy to manipulate and much unwanted event abusing can be exploited through client-side XSS, but I don't think that this would be much of a problem. You can always add a regexp to stop dynamic IFrame src attributes.

Example below.

Code:
var regex = /javascript\:(.*)+/gi;
var ifr = document.getElementsByTagName('iframe');
for(var i = 0; i < ifr.length; i++) {
if(regex.test(ifr[i].getAttribute('src').toString())) { ifr[i].setAttribute('src',''); }
}
avatar
Ultron's Vision
Forumember

Male Posts : 634
Reputation : 45
Language : English | German | HTML | JavaScript | PHP | C++ | Perl | Java
Location : Vienna, Austria

http://duelacademy.net

Back to top Go down

Re: Coding a PHP menu

Post by LGforum on Wed Jun 12, 2013 12:52 pm

PHP isn't a language that creates a menu. The PHP you're using is simply creating the markup (and possibly Javascript) for a menu.

You should be able to recreate the markup, which is no doubt HTML and if it requires and Javascript then you should be able to get that too.

Off the website you showed me... I'm hoping you own it or at least have permission to do so... because here is the Javascript for that menu:
Code:
function mainNavChildren(parent , level){
      jQuery(parent).children("li").each(function(i , obj){
         var label = "";
         for(var k = 0 ; k < level ; k++){
            label += "    ";
         }
         label += jQuery(obj).children("a").text();
         jQuery("#responsive-main-nav-menu").append("<option value = '" + jQuery(obj).children("a").attr("href") + "'>" + label + "</option>");
         
         if(jQuery(obj).children("ul").size() == 1){
            mainNavChildren(jQuery(obj).children("ul") , level + 1);
         }
      });
   }
mainNavChildren(jQuery("#main-navigation > ul") , 0);

And here is the HTML:
Code:
<div id="navigation-wrapper" class="clearfix">
                     <select id="responsive-main-nav-menu" onchange="javascript:window.location.replace(this.value);"><option selected="selected">Menu</option><option value="#">Get  Involved</option><option value="http://forums.gamesleepcreate.com">    Forums</option><option value="http://gamesleepcreate.com/monster-moments-top-5-kills/">    Monster Moments Top 5 Kills</option><option value="#">Get Gaming</option><option value="http://gamesleepcreate.com/the-monster-live/">    LiveStream</option><option value="#">    Videos</option><option value="http://gamesleepcreate.com/pwnzone/">        The Pwnzone</option><option value="http://gamesleepcreate.com/playthroughs/">        Let’s Play: Full Game Playthrough’s</option><option value="http://gamesleepcreate.com/category/digital-art/">Get Creative</option><option value="http://gamesleepcreate.com/category/digital-art/">    Digital Art</option><option value="http://gamesleepcreate.com/speedart/">    SpeedArt Videos</option><option value="http://gamesleepcreate.com/dozombiestastelikebacon/">    Do Zombies taste like Bacon?</option><option value="#">Get  Involved</option><option value="http://forums.gamesleepcreate.com">    Forums</option><option value="http://gamesleepcreate.com/monster-moments-top-5-kills/">    Monster Moments Top 5 Kills</option><option value="#">Get Gaming</option><option value="http://gamesleepcreate.com/the-monster-live/">    LiveStream</option><option value="#">    Videos</option><option value="http://gamesleepcreate.com/pwnzone/">        The Pwnzone</option><option value="http://gamesleepcreate.com/playthroughs/">        Let’s Play: Full Game Playthrough’s</option><option value="http://gamesleepcreate.com/category/digital-art/">Get Creative</option><option value="http://gamesleepcreate.com/category/digital-art/">    Digital Art</option><option value="http://gamesleepcreate.com/speedart/">    SpeedArt Videos</option><option value="http://gamesleepcreate.com/dozombiestastelikebacon/">    Do Zombies taste like Bacon?</option></select>
                     
                     <nav id="main-navigation" class="main-menu">
                     <ul id="menu-main-nav" class="sf-menu"><li id="menu-item-206" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-206"><a href="#" style="padding-right: 23px;">Get  Involved<span class="downarrowclass"></span></a>
<ul class="sub-menu" style="top: 55px; visibility: visible; left: 0px; width: 175px; display: none;">
   <li id="menu-item-405" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-405"><a href="http://forums.gamesleepcreate.com">Forums</a></li>
   <li id="menu-item-143" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-143"><a href="http://gamesleepcreate.com/monster-moments-top-5-kills/">Monster Moments Top 5 Kills</a></li>
</ul>
</li>
<li id="menu-item-142" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-142"><a href="#" style="padding-right: 23px;">Get Gaming<span class="downarrowclass"></span></a>
<ul class="sub-menu" style="top: 55px; visibility: visible; left: 0px; width: 175px; display: none;">
   <li id="menu-item-365" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-365"><a href="http://gamesleepcreate.com/the-monster-live/">LiveStream</a></li>
   <li id="menu-item-363" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-363"><a href="#">Videos<span class="rightarrowclass"></span></a>
   <ul class="sub-menu" style="top: 0px; visibility: visible; left: 175px; width: 183px; display: none;">
      <li id="menu-item-141" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-141"><a href="http://gamesleepcreate.com/pwnzone/">The Pwnzone</a></li>
      <li id="menu-item-160" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-160"><a href="http://gamesleepcreate.com/playthroughs/">Let’s Play: Full Game Playthrough’s</a></li>
   </ul>
</li>
</ul>
</li>
<li id="menu-item-6" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-6"><a href="http://gamesleepcreate.com/category/digital-art/" style="padding-right: 23px;">Get Creative<span class="downarrowclass"></span></a>
<ul class="sub-menu" style="top: 55px; visibility: visible; left: 0px; width: 175px; display: none;">
   <li id="menu-item-162" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-162"><a href="http://gamesleepcreate.com/category/digital-art/">Digital Art</a></li>
   <li id="menu-item-147" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-147"><a href="http://gamesleepcreate.com/speedart/">SpeedArt Videos</a></li>
   <li id="menu-item-191" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-191"><a href="http://gamesleepcreate.com/dozombiestastelikebacon/">Do Zombies taste like Bacon?</a></li>
</ul>
</li>
</ul>                     </nav>
               </div>

What's needed is simply the CSS. Which is this:
Code:
.downarrowclass, .rightarrowclass {
width: 8px;
height: 8px;
display: inline-block;
position: absolute;
right: 5px;
top: 26px;
}
#main-navigation select {    display: none }
#main-navigation {    float: right }
 #main-navigation > ul {    margin: 0px 0 0 5px }
 #main-navigation ul li {
    list-style: none;
    float: left;
    position: relative;
 }
#main-navigation li a {
color: #898989;
font-family: 'Dosis', 'Verdana', sans-serif;
font-size: 16px;
font-weight: normal;
padding: 20px 12px 5px 12px;
margin: 0px 0px 10px 0;
position: relative;
text-align: center;
text-transform: uppercase;
float: left;
overflow: hidden;
line-height: 20px;
}
 #main-navigation ul li a:hover,
 #main-navigation ul li.current-menu-ancestor > a,
 #main-navigation ul li.current-menu-item > a {
    color: #9dcedf;
    border-bottom: 1pt solid #9dcedf;
 }
 #main-navigation ul ul li a {
    display: block;
    float: none;
 }
 #main-navigation ul ul {
    background: url("../images/menu-drop-bg.png") 20% 0% no-repeat;
    padding-top: 8px;
    display: none;
    left: 0;
    margin-top: -18px;
    position: absolute;
    width: 175px;
    z-index: 99;
    border-radius: 2px;
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
 }
  #main-navigation ul ul ul {
      background: url("../images/menu-drop-bg-2.png") 0% 50% no-repeat;
      padding-left: 8px;
      display: none;
      left: 0;
      position: absolute;
      width: 175px;
      z-index: 99;
      border-radius: 2px;
      -moz-border-radius: 2px;
      -webkit-border-radius: 2px;
  }
  #main-navigation ul ul ul  ul {
      background: url("../images/menu-drop-bg-2.png") 0% 50% no-repeat;
      padding-left: 8px;
      display: none;
      margin-left: 10px;
      left: 0;
      position: absolute;
      width: 175px;
      z-index: 99;
      border-radius: 2px;
      -moz-border-radius: 2px;
      -webkit-border-radius: 2px;
  }
  #main-navigation ul ul  li,
  #main-navigation ul ul  li a {
      padding: 0px 0 0 0px;
      margin: 0px;
      color: #FFF;
      background: #615951;
      font-family: "Arial", "Verdana";
  }
  #main-navigation ul ul  li { }
  #main-navigation ul ul li {    float: none }
 #main-navigation ul li {
    padding: 0;
    margin: 0 0 0 5px;
 }
 #main-navigation ul ul a {
    border: 0;
    color: #fff;
    display: block;
    font-size: 11px;
    font-weight: 400;
    padding: 5px 10px !important;
    text-align: left;
    margin: 0;
    text-transform: none;
 }
 #main-navigation ul ul a:hover,
 #main-navigation ul ul .hover > a,
 #main-navigation ul ul .current-menu-item > a,
 #main-navigation ul ul .current-menu-item > a:hover {
    background: #9dcedf ;
    color: #fff !important;
    border: 0 !important;
 }
 #main-navigation ul li ul {
    position: absolute;
    left: 0px;
    display: block;
    visibility: hidden;
    margin-left: 0px;
    top: 0;
 }
.downarrowclass, .rightarrowclass {
width: 8px;
height: 8px;
display: inline-block;
position: absolute;
right: 5px;
top: 26px;
}
 .rightarrowclass {
  }

If you do not own that site or rights to use that menu, then tell me now as this post will need the codes removing.
avatar
LGforum
Hyperactive

Male Posts : 2262
Reputation : 260
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: Coding a PHP menu

Post by SyndromeLA on Thu Jun 13, 2013 1:00 am

I own the site.
Thanks for the coding.
avatar
SyndromeLA
New Member

Posts : 21
Reputation : 0
Language : English

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum