어제와 비슷한 질문이긴 한데 PHP(애드온)에 들어갈 문구 입니다.

 

어떠한 내용을 출력하려고 합니다. 내용은 애드온 info.xml 에서 입력을 받은 내용입니다.

 

단지 조건은 아주 간단합니다만 이게 가능한 조건인지 모르겠어요.

 

XE의 본문안에 #이라는 문자가 없다면 이라는 조건입니다. 순수하게 글로 입력된 부분에 #이 없다면 이라는 조건으로 걸고 싶습니다.

 

 

  • profile
    strip_tags 였나? 그걸로 HTML태그는 완전히 없앤 뒤 남은 문구중에 #이 있는지 없는지 확인하면 되겠네요.
  • profile
    음...

    $block_words = "#";
    $count_block_words = strpos(strip_tags(문서), $block_words);

    if($count_block_words == false){
    (#이 포함되지 않음)
    }
  • profile profile
    $obj = Context::get('oDocument');

    $block_words = ($addon_info->denied_word_content);
    $count_block_words = count($block_words);

    if($count_block_words == false ) {

    // 금지단어가 없다면 출력
    $output = str_replace("<!--AfterDocument(", $addon_info->add_contents."<!--AfterDocument(", $output);


    현재 이 상태인데 잘 안되네요.....
  • profile profile
    $block_words = ($addon_info->denied_word_content);
    $count_block_words = count($block_words);

    이 부분을

    $block_words = ($addon_info->denied_word_content);
    $count_block_words = strpos($obj->getContent(false), $block_words);

    로 바꿔보세요.
  • profile profile
    Fatal Error: Call to a member function getContent() on a non-object

    이 에러가 발생하네요.
  • profile profile
    $count_block_words = strpos($obj->getContent(false), $block_words);
    이걸
    $count_block_words = strpos($output, $block_words);
    으로 해보세요.

    $obj 변수가 선언되어 있길래.... 사용하면 되는건줄 알았는데...
  • profile profile
    변수는 지웠는데요.. 그럼 변수 넣고 해보고
    지금 것도 해볼게요.
  • profile profile
    아니면...

    $obj = Context::get('oDocument'); 이걸

    $oDocumentModel = getModel('document');
    $obj = $oDocumentModel->getDocument(Context::get('document_srl'));

    로 바꿔보세요.
  • profile profile
    성공했습니다. 변수를 살니니까 이제 잘 동작하네요. 감사합니다.

    이 질문으로 만든 애드온은 해시태그 활성화를 위해 해시태그를 보통 넣지 않는 일반 회원들의 글 하단에 해시태그 안내를 출력해 주려고 만들었어요.

    잘 됩니다. 도움 너무 감사합니다!
  • profile profile
    네~ 잘 되어서 다행입니다!