Affect a value to a field without form

Author Message

Anthony M.

Friday 25 January 2008 12:29:01 am

Hi,

i have created a class with the field 'title', and i can access to the value with :

{$node.data_map.title.value}

but is it possible to affect a value to this field (without a form) like :

{def $node.data_map.title.value = 'test'}

Thanks for your help

Anthony

Felix Laate

Friday 25 January 2008 5:08:23 am

Hi!

Not sure if this is what you need. But with javascript you could:


<script>
document.getElementById('mytitle').innerHTML = 'test';
</script>

<span id="mytitle">{$node.data_map.title.value}</span>

Cheers!

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Anthony M.

Friday 25 January 2008 6:52:25 am

it's not that... i want to insert in the database, to fill in the field of the node automatically, do you understand ?

Anthony

Atle Pedersen

Friday 25 January 2008 9:10:10 am

Unfortunately eZ has no mechanism that allow you do do such a thing. You cannot manipulate the database from inside a template.

What you maybe could do is creating a javascript doing a post call to content/action with the desired data.

Piotrek Karaƛ

Saturday 26 January 2008 2:11:20 am

Hello everyone,

It is possible by means of creating your own PHP/SQL interface for such changes (or maybe even using eZ API), but it is not considered a normal routine as far as I know, since you will be ignoring/braking versionning abstract layer. You have to understand what you're doing and how data is stored in the attributes' db table. I have used that approach in several cases, for example for flagging or periodic shuffling purposes.

Good luck,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 11:43:31
Script start
Timing: Jan 18 2025 11:43:31
Module start 'layout'
Timing: Jan 18 2025 11:43:31
Module start 'content'
Timing: Jan 18 2025 11:43:31
Module end 'content'
Timing: Jan 18 2025 11:43:31
Script end

Main resources:

Total runtime0.0164 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.0313152.6406
Module start 'layout' 0.00580.0031 740.671939.4609
Module start 'content' 0.00890.0053 780.132893.4453
Module end 'content' 0.01420.0021 873.578134.3047
Script end 0.0163  907.8828 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002515.1267140.0002
Check MTime0.00116.8623140.0001
Mysql Total
Database connection0.00138.088110.0013
Mysqli_queries0.002615.963430.0009
Looping result0.00000.067010.0000
Template Total0.001710.310.0017
Template load0.00095.470310.0009
Template processing0.00084.756110.0008
Override
Cache load0.00063.789710.0006
General
dbfile0.00031.607780.0000
String conversion0.00000.055440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs