将Smarty变量传递给对象参数

I am using the Smarty engine and I want to pass a Smarty variable to an object argument.

My index.php:

<?php 
$smarty = new Smarty;
$smarty->registerObject('articles',$articles);

if (isset($_GET['task'])){
    $smarty->assign('articleid',$_GET['id']);
}

My class for edit article:

   public function editArticle($id) {

       // database connection
       $conn = parent::Db();
       $q = $conn->prepare('SELECT * FROM articles WHERE id = :id ');
       $q->execute(array(':id'=> $id ));
       $results = $q->fetchAll(PDO::FETCH_ASSOC); 
       ....
   }

I want id for my function and my tpl:

{if isset($smarty.get.task) && $smarty.get.task eq articleedit} 
<div class="box">
    <div class="box-header"> <h3 class="box-title">Bordered Table</h3></div>
    <div class="box-body">

            {articles->editArticle p1=$articleid }

    </div>
</div>
{/if}

How can I pass an argument to my object? I read the Smarty document and it suggested this line :

{articles->editArticle p1=$articleid }

but doesn't work for me.

In PHP you should do:

$smarty->registerObject('articles',$articles);

In Smarty you should do:

{articles->editArticle($articleId)} 

If it does not work, you should add more code how you assigned variable to Smarty.