Getting started

Permalink
Hi guys

Just want to say hi and I hope to speak with you all at some point.

I'm sure this question has been asked a thousand times and i can already see the feedback now but i'm new to this and I want to get start coding concrete5 in the right way, so apologies upfront. I'm not looking for abuse, just help!

There doesn't appear to be any good tutorial videos using the latest version.

I've downloaded concrete5 8.1 and installed successfully.

I've added a folder in my themes folder and gave it a thumbnail, full.php and description files and that appears ok.

I've added the following lines to my code that show me the toolbar
<?php Loader::element('header_required') ?> 
<?php Loader::element('footer_required') ?>


For security
<?php defined('C5_EXECUTE') or die("Access Denied.");?>


To link external files
<?= $view->getThemePath() ?>/


To replace the current jquery with the latest version
<?php
// conditionally load jQuery 2.x based on whether the toolbar is visible or a user is logged in
$currentPermissions = new Permissions($c);
  $user = new User;
  if (!$currentPermissions->canViewToolbar() || !$user->isLoggedIn()) { ?>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<?php } ?>


Wrap the website within a container so it slides when using the sidebars
<div class="<?= $c->getPageWrapperClass() ?>">
</div>


Finally to add a block section
<?php
  $a = new Area('Area Name');
  $a->display($c);
?>


As far as i'm aware, this is all that's needed to get started.

So here's my questions:

1: Where should the 'change the current jquery to the latest version' part go within the page?

2: You'll laugh at this question. So I add a text block in concrete5 and edit the text and there's no style. Normally in a html site, I would wrap the text in a div and give it a class, do I do the same here or is there another way to style the text?

3: I want to add a button in my navigation where it tells the user that they are logged in, if they're currently signed out, it would change to log in, how do I do this?

Thanks for reading.

 
ramonleenders replied on at Permalink Reply
ramonleenders
1. Do you really need the newest jQuery version, is the version of concrete5 (v1.11.3) not high enough? You could paste the code you have into the header if you'd like or read here about providing jquery by the page_theme.php file:

https://documentation.concrete5.org/tutorials/requireasset-and-provi...

2. What do you plan on achieving? Can you give us some HTML to work with? You can make Block Templates, but maybe you're better off creating a whole new Block Type?

3. You already had a bit of the code. Example

<?php 
$u = new User();
if($u->isLoggedIn()){
 echo 'You are logged in';
}
else {
echo 'You are NOT logged in, log in here (make the link)';
}
Danuk9 replied on at Permalink Reply
Thanks for the reply.

Basically I would like to achieve the linked site using concrete5.

codyhouse.co/demo/vertical-fixed-navigation/index.html


It's a 1 page site and each section will be another page

I don't even know where to begin converting this to concrete5
ramonleenders replied on at Permalink Reply
ramonleenders
You could make them all as being area's maybe? So each "section" has an area, where you place your blocks?
Danuk9 replied on at Permalink Reply
Thanks ramonleenders

Really appreciate your replies.

What are areas and how do i add them? can you please give me an example?

I've also removed my jquery and i'm trying to use the concrete5's version but it's not working when you are logged out.

I understand you can add a theme_page.php do you need to include this? here's the code i've used

<?php
namespace Application\Theme\Vertical;
use Concrete\Core\Page\Theme\Theme;
class PageTheme extends Theme {
   public function registerAssets() {
      $this->requireAsset('javascript', 'jquery');
   }
}


EDIT: I got the page_theme.php working, i understand that you need to delete the theme and reactivate it, jquery now works front end when the user is signed out.
ramonleenders replied on at Permalink Reply
ramonleenders
If you say rquireAsset, you will tell the system to let the system include it for you. You wanted to include your own version though? So you'd need provideAsset. Be sure to include it in your <head> section, before the "header_required" part!

As for area's, this is an area:

<?php
$a = new Area('Section One');
$a->display();
?>


You could do another one, by renaming 'Section One' to 'Section Two' or 'Section Portfolio' or whatever you want to name your areas!