DEV Community

웹학교
웹학교

Posted on • Edited on

2 2

그누보드5 - 내용관리가 아닌 일반페이지 추가하기

그누보드5공개형 보드입니다.
게시판을 중심으로 회원관리, 내용관리 등의 기능이 내장되어 있어 완벽한 홈페이지를 제작할 수 있는 오픈 소스입니다.

게시판이 아닌 페이지 추가를 쉽게 하기 위해 내용관리가 내장되어 있습니다.

그런데 편집기를 이용하여 직접 페이지를 추가하고 싶을 땐?

common.php

이 파일이 필요합니다.
이 파일을 include하면 그누보드5의 모든 함수와 선언된 상수를 사용할 수 있습니다.
이 파일은 그누보드가 설치된 Root 폴더에 위치합니다.
(예: 그누보드가 /home/abc 에 설치되어 있다면 해당 파일은 /home/abc폴더에 있습니다.)

include_once('./common.php');
Enter fullscreen mode Exit fullscreen mode

그런데 그누보드5 폴더와 파일을 들여다 보면 위 파일을 직접 사용하는 경우는 드물고 _common.php파일을 만들어 사용합니다.

그래서 대부분 파일을 열어 보면

include_once('./_common.php');
Enter fullscreen mode Exit fullscreen mode

이렇게 되어 있는 것을 볼 수 있습니다.

_common.php 파일의 내용

여기서 중요합니다. 이 파일내 common.php파일을 include할 때 경로를 잘 지정해 주어야 합니다.

그누보드5가 설치된 Root폴더에 파일을 추가한다면

include_once('./common.php');
Enter fullscreen mode Exit fullscreen mode

이렇게 하면 됩니다. (Root 폴더에는 이미 해당 파일이 있습니다.)

그런데 abc라는 폴더를 만들고 그 안에 _common.php파일을 만든다면?
이럴 때는 common.php파일이 있는 위치와 상대경로를 확인하여 반영해 주어야 합니다.

  • /그누보드5설치루트/abc인 경우
include_once('../common.php');
Enter fullscreen mode Exit fullscreen mode
  • /그누보드5설치루트/임의폴더/abc인 경우
include_once('../../common.php');
Enter fullscreen mode Exit fullscreen mode
  • /그누보드5설치루트/임의폴더/임의폴더/abc인 경우
include_once('../../../common.php');
Enter fullscreen mode Exit fullscreen mode

그누보드5강좌

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay