Jump to content

JakkkeM

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by JakkkeM

  1. The problem I had with return, was that instead of giving me all of my menus, it only returned the first one... :/ I'll test it with the new SQL format and see how I go.
  2. Unfortunately, and this is where the amateur part comes in, I don't know how to do anything you suggested. Haha.
  3. Hi Guys, I'm an amateur coder working on a huge project probably way above my capabilities and thus continue to run into problems. So, I seek your help! In my developing system, I'm making a dynamic website so you can control the front-end from the back-end. To edit the front-end you have a page Manage Layout which allows you to edit the HTML of the home page. Then you just type in my custom elements like, [menu], etc. I'm using preg_replace to change these into the scripts I require. The HTML of the homepage is contained in a database, then when it's executed on the homepage I do the preg replace etc. What I'm doing for my [menu] is: Now, the problem occurs. It executes this 100%, the preg_replace carries it out perfectly, BUT instead of it executing where I've placed it in the overall position on the page, it puts everything on the first line after the <body> tag... The preg_replace simply replaces [menu] with createMenu(); so I would've thought that my function would be executed wherever I had [menu]??? I'm not entirely sure what I've said is clear but lets hope so. Cheers. ABOVE:The menu is being placed on the first line, rather than in the div where I have [menu] (which is consequently to the right of the CrossFit St Marys Logo)
  4. That's it. Haha how should I approach it?
  5. FOR THE RECORD: I do realise that the code I have in there only determines if you're logged in then calls your name - debugging purposes haha
  6. Hey I'm creating a small system for a high school project, and I need to be able to control content on the front end from the back end. I've hooked most of it up successfully however now I have a small dilemma. How it works is you edit a "website layout" page, which shows you raw HTML (shown below) and you put in a bb code of "[element=title]" for example, and this is then converted into a function which displays the content of that database entry... These elements are then individually edited. However, I now have the need to display some PHP in elements... For example, as seen below, determining what menu you see depending on your level of access or if you're signed in... BUT... When this get's to the output: My PHP is a string... Any suggestions? Thanks...
  7. Kicken Using your working example, how can I now use php in my elements? I.e. if I wanted to put <?php echo $username; ?>, what would I need to do? At the moment I think it's just returning it as a string again...
  8. Ignore last - forgot to strip slashes! Thanks HEAPS everyone for your help! :happy-04: :happy-04:
  9. THANK YOU! Works! Now I run another problem... I have: <span style="font-family:CFSImpact; font-size:31pt; color:#FFF;">Test</span> <span style="font-family:CFSImpact; font-size:31pt; color:#C00;">Title</span> In one of my elements, but it's returning it as plain text? I do have another section that has an image rotator: <div id="myCarousel" class="carousel slide"> <!-- Carousel items --> <div class="carousel-inner"> <div class="active item"> <img src="_images/scroll/Scroll_1.jpg" alt=""> <div class="carousel-caption"> <h4>Third Thumbnail label</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img src="_images/scroll/Scroll_2.jpg" alt=""> <div class="carousel-caption"> <h4>Third Thumbnail label</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img src="_images/scroll/Scroll_3.jpg" alt=""> <div class="carousel-caption"> <h4>Third Thumbnail label</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> </div> <!-- Carousel nav --> </div> That is returning just fine?! What's happening D:
  10. If I do this, it just prints element("variable") onto the screen...
  11. If I'm understanding correctly, then no. It needs to be calling a variable - I have 6 or 7 "elements" that it should changing: menu; logo; left; right; disclaimer. etc...
  12. I'll try and create a lifeline of the code here... <div class="row-fluid"> <div class="span12">[element="scroll"]</div> </div> I have this on my admin panel which I then addslashes too and it puts it into my database. I then call it back onto my page.php with a query and stripslashes Then I call the function bbElement($the_variable_I_stripped); Ideally the BB element then finds my [element=x] codes and replaces them with <?php elementCreate(x); ?>
  13. Not too sure what your first part means there. Haha. I don't have a background in web development, I'm building on some cool trial-and-error things I've done so I have no clue. And I'm only reluctant to change that $1 because from my understanding in that array with pregreplace it has to be $1, $2 ... "/\[img align=(.*?) src=(.*?)\]/is", ... ... "<img align=\"$1\" src=\"$2\" style=\"margin:10px;\">", ... If there's a better way to do this - I'll change it haha - Just can't off my own back.
  14. The quote marks were my bad in the post - they're not in use in the code what so ever. For the my use of $1 it's fine. None-the-less. The PHP there is within HTML Without the PHP tags it just returns "echo elementCreate(right)" on the page.
  15. Hi Guys, From what I can tell, there is no other similar inquiry around... I'm completing my Higher School Certificate (final year of high school in New South Wales Australia) and I'm creating a web system for a major. Part of it requires me to have fully dynamic pages for my clients purpose, and I'm using database elements - so basically there is a BB Code site editor that translates [element=menu] to <?php elementCreate("menu"); ?> What I'm finding for some reason I can't contemplate, is that it's just blatantly not working! And when I use view source the <?php elementCreate("menu"); ?> is green as if it's a comment? function bbElement($transform){ $a = array( "/\[element=\"(.*?)\"\]/is", ); $b = array( "<?php echo elementCreate($1); ?>", ); $transform = preg_replace($a, $b, $transform); return $transform; } function elementCreate($element){ $element_fetch = mysql_query("SELECT * FROM `elements` WHERE `element_name` = '".$element."'")or die(mysql_error()); while($element_info = mysql_fetch_array($element_fetch, MYSQL_ASSOC)){ $econt = $element_info['content']; } return $econt; } It's quiet likely I've missed something simple - but all help is appreciated! Cheers.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.