Page 1 of 2

Want to assign the Article_ID in a template! How to call....

Posted: Wed 16. Feb 2005, 13:39
by Bobo
Hi Folks,

I want to assign the article_ID inside a list template. I am using the same inside the view template:

Code: Select all

[PHP]echo "<img border=\"0\" src=\"picture/"."".$GLOBALS['content']['article_id']."_galery.jpg\" >";[/PHP]
This works fine!!!
It seems that I have to use other parameters inside the listview. Because using the above code, the rewturned value is empty!

Look at the properties of the first article at http://www.ringelimmobilien.de/index.php?offers.

The filename should be .../10_galery.jpg...

Someone can help out???

Best regards

Bobo

Posted: Wed 16. Feb 2005, 14:25
by brans
http://www.phpwcms.de/forum/viewtopic.php?t=5513

watch this thread for further information.

This one I know...

Posted: Wed 16. Feb 2005, 14:29
by Bobo
brans wrote:http://www.phpwcms.de/forum/viewtopic.php?t=5513

watch this thread for further information.
Hi brans,

this one I know, but it doesn't help... I suppose that I only have to modify "content" or to add another ['statement'] between. But I dont know which on...

Code: Select all

$GLOBALS['content']['statement']['article_id']

Posted: Wed 16. Feb 2005, 15:03
by brans
no I guess that you are completely wrong. These replacement-tags inside the templates are rendered on a very static way.

I mean really watch this thread, if you don't understand thatone, then you will probably have to ask someone else to come up with a solution for you

Posted: Wed 16. Feb 2005, 22:10
by Oliver Georgi
This way - $content['article_id'] does not exist when in list mode. But better do a check as bottom.

Code: Select all

[PHP]
$_cur_articleID = empty($GLOBALS['content']['article_id']) ? $GLOBALS['aktion'][1] : $GLOBALS['content']['article_id'];
echo '<img src="picture/'.$_cur_articleID.'_galery.jpg" border="0">';
[/PHP]
Oliver

Your code Snipp...

Posted: Wed 16. Feb 2005, 22:18
by Bobo
Oliver Georgi wrote:This way - $content['article_id'] does not exist when in list mode. But better do a check as bottom.

Code: Select all

[PHP]
$_cur_articleID = empty($GLOBALS['content']['article_id']) ? $GLOBALS['aktion'][1] : $GLOBALS['content']['article_id'];
echo '<img src="picture/'.$_cur_articleID.'_galery.jpg" border="0">';
[/PHP]
Oliver
First of all thank you for your assitance, but the value which will be returned by using the above code is "0". Just look at the picture properties of the first article at http://www.ringelimmobilien.de/index.php?offers

Best regards so far...

bobo

Posted: Wed 16. Feb 2005, 22:28
by Oliver Georgi
you can not use it in this way!!! This will always return 0 because listing does not have an article ID.

Oliver

???

Posted: Wed 16. Feb 2005, 22:49
by Bobo
Oliver Georgi wrote:you can not use it in this way!!! This will always return 0 because listing does not have an article ID.

Oliver
OK, I understand! To explain a little bit more my intenntion of use: I want lets say automatically assign a picture to the custom template. I thought that it is easy because I use a similar way in the vie template of each article, which look for 2 pictures like "articleid_leftpicture.jpg" and the same for the right on.... And due to that you are creating Tags like "Articlelink" it must be possible, or??? ;-)

Posted: Wed 16. Feb 2005, 23:37
by Oliver Georgi
OK - small patch in front.func.inc.php in function list_articles_summary()

after:

Code: Select all

//rendering
$tmpl = $tmpllist[ $article_list[$key]["article_image"]['tmpllist'] ];
paste in:

Code: Select all

$tmpl = render_cnt_template($tmpl, 'EDITOR', $article_list[$key]["article_username"]);
$tmpl = render_cnt_template($tmpl, 'ARTICLEID', $article_list[$key]["article_id"]);
New Tag for list template: ARTICLEID and EDITOR

Oliver

Thanx a lot!!!

Posted: Thu 17. Feb 2005, 01:04
by Bobo
Oliver Georgi wrote:OK - small patch in front.func.inc.php in function list_articles_summary()

after:

Code: Select all

//rendering
$tmpl = $tmpllist[ $article_list[$key]["article_image"]['tmpllist'] ];
paste in:

Code: Select all

$tmpl = render_cnt_template($tmpl, 'EDITOR', $article_list[$key]["article_username"]);
$tmpl = render_cnt_template($tmpl, 'ARTICLEID', $article_list[$key]["article_id"]);
New Tag for list template: ARTICLEID and EDITOR

Oliver
Thanx a lot Oliver....

It works like a charme....

Best regards from Hamburg

Bobo

Posted: Thu 17. Feb 2005, 15:29
by marcus@localhorst
Holla,

I need the article_id and the article_title in the frontend_render.
how do i get this?

thanks marcus

Posted: Thu 17. Feb 2005, 15:52
by Oliver Georgi
This is very easy

You can access catID and articleID (as long as not in list mode) like this:

catID:

Code: Select all

$GLOBALS['aktion'][0];
$GLOBALS['content']['cat_id'];
articleID:

Code: Select all

$GLOBALS['aktion'][1];
$GLOBALS['content']['article_id'];
articleTitle should be (when not in list mode):

Code: Select all

$GLOBALS['content']['articles'][$GLOBALS['aktion'][1]]['article_title'];
Oliver

Posted: Thu 17. Feb 2005, 15:57
by marcus@localhorst
i need it both modes :?

Posted: Thu 17. Feb 2005, 16:44
by Oliver Georgi
But it does not exist for both modes - when you are in list mode there is NO article ID and if no article ID no title exists.

Or what do you mean?

Oliver

Posted: Thu 17. Feb 2005, 20:03
by marcus@localhorst
the example:

i try to build a simple cart. each article in a category is a product.
with a replacementtag i build the form button, to add an article to cart.
i will send the article_id and article_title as POST variables. and so i thought i detect the article_id inside the frontend_render.
hope you know what i mean. (ich könnt es auch in deutsch schreiben ;-) mein englisch ist nicht so gut.)

jeder CMSartikel ist ein Shopartikel. Mit einem Replacementtag möchte ich den "in warenkorb hinzufügen" button generieren (das Tag wird im frontend_render ordner geparst. Dort brauche ich den artikeltitel und die id. diese übergebe ich dann an die addtocart funktion um id und titel in einem array zu speichern.

ich hoffe ich konnte es einigermaßen erklären.
grüße marcus